@@ -15,30 +15,29 @@ describe('Wildcard Searches', () => {
1515
1616 describe ( 'SearchRequest.tokenizeSearchText()' , ( ) => {
1717 const testCases : Array < { input : string ; expected : string [ ] ; } > = [
18- // Wildcards in 1 term
19- { input : `"microsoft"` , expected : [ "microsoft " ] } ,
20- { input : "127.0.0.*" , expected : [ "127.0.0. *" ] } ,
21- { input : `"microsoft *"` , expected : [ "microsoft *" ] } ,
22- // Wildcards in 2 terms
23- { input : `"micro* office "` , expected : [ "micro* office " ] } ,
24- { input : `"microsoft off* "` , expected : [ "microsoft off* " ] } ,
25- { input : `"*soft office "` , expected : [ "*soft office " ] } ,
26- { input : `"*soft off *"` , expected : [ "*soft off *" ] } ,
27- { input : `"CVE*" "micro*"` , expected : [ "CVE*" , "micro*" ] } ,
28- // Wildcards in 3 terms
29- { input : `"CVE*" "microsoft*" "off*"` , expected : [ "CVE*" , "microsoft*" , "off*" ] } ,
30- // Wildcards in phrases
31- { input : `"microsoft off* "` , expected : [ "microsoft off* " ] } ,
32- { input : `"CVE*" "*soft office"` , expected : [ "CVE*" , "*soft office" ] } ,
33- ] ;
34-
35- testCases . forEach ( ( { input, expected } ) => {
36- it ( `should correctly tokenize " ${ input } " into ${ JSON . stringify ( expected ) } ` , ( ) => {
37- const result = SearchRequest . tokenizeSearchText ( input ) ;
38- expect ( result ) . toEqual ( expected ) ;
18+ // Wildcards in 1 term
19+ { input : "127.0.0.*" , expected : [ "127.0.0.* " ] } ,
20+ { input : `"microsoft *"` , expected : [ "microsoft *" ] } ,
21+ // Wildcards in 2 terms
22+ { input : `"micro* office"` , expected : [ "micro* office" ] } ,
23+ { input : `"microsoft off* "` , expected : [ "microsoft off* " ] } ,
24+ { input : `"*soft office "` , expected : [ "*soft office " ] } ,
25+ { input : `"*soft off* "` , expected : [ "*soft off* " ] } ,
26+ { input : `"CVE*" "micro *"` , expected : [ "CVE*" , "micro *"] } ,
27+ // Wildcards in 3 terms
28+ { input : `"CVE*" "microsoft*" "off*"` , expected : [ "CVE*" , "microsoft*" , "off*" ] } ,
29+ // Wildcards in phrases
30+ { input : `"microsoft off*"` , expected : [ "microsoft off*" ] } ,
31+ { input : `"CVE*" "*soft office "` , expected : [ "CVE*" , "*soft office "] } ,
32+ ] ;
33+
34+ testCases . forEach ( ( { input , expected } ) => {
35+ it ( `should correctly tokenize " ${ input } " into ${ JSON . stringify ( expected ) } ` , ( ) => {
36+ const result = SearchRequest . tokenizeSearchText ( input ) ;
37+ expect ( result ) . toEqual ( expected ) ;
38+ } ) ;
3939 } ) ;
4040 } ) ;
41- } ) ;
4241
4342
4443 describe ( 'SearchRequest.findSearchRequestType()' , ( ) => {
@@ -130,6 +129,15 @@ describe('Wildcard Searches', () => {
130129 { input : "m*cro*f*" , succeed : true , expectedNum : 52 } , //@todo , expected 65, same as "micro*"
131130 { input : "m**t" , succeed : true , expectedNum : 237 } , //@todo , should return error due to repeating *
132131 { input : "m*****t" , succeed : true , expectedNum : 237 } , //@todo , should return error due to repeating *
132+ // @todo
133+ // [`"micro????"`, [`"micro????"`]], // @todo
134+ // [`micro*`, [`micro*`]],
135+ // [`*micro*`, [`*micro*`]],
136+ // [`*micro**`, [`*micro**`]],
137+ // [`*micro *`, [`*micro`, `*`]],
138+ // [`micro????`, [`micro????`]],
139+ // [`micro*????`, [`micro*????`]],
140+
133141 // ----- ????? -----
134142 // { input: ".127.0.0.*", expectedNum: 2 },
135143 // { input: ".127.0.0.???", expectedType: 'SEARCH_AS_WILDCARD_QUESTION', expectedProcessedText: ".127.0.0.???" }, //
0 commit comments