@@ -199,12 +199,12 @@ suite('Fuzzy Scorer', () => {
199
199
assert . ok ( pathRes . score ) ;
200
200
assert . ok ( pathRes . descriptionMatch ) ;
201
201
assert . ok ( pathRes . labelMatch ) ;
202
- assert . strictEqual ( pathRes . labelMatch ! . length , 1 ) ;
203
- assert . strictEqual ( pathRes . labelMatch ! [ 0 ] . start , 8 ) ;
204
- assert . strictEqual ( pathRes . labelMatch ! [ 0 ] . end , 11 ) ;
205
- assert . strictEqual ( pathRes . descriptionMatch ! . length , 1 ) ;
206
- assert . strictEqual ( pathRes . descriptionMatch ! [ 0 ] . start , 1 ) ;
207
- assert . strictEqual ( pathRes . descriptionMatch ! [ 0 ] . end , 4 ) ;
202
+ assert . strictEqual ( pathRes . labelMatch . length , 1 ) ;
203
+ assert . strictEqual ( pathRes . labelMatch [ 0 ] . start , 8 ) ;
204
+ assert . strictEqual ( pathRes . labelMatch [ 0 ] . end , 11 ) ;
205
+ assert . strictEqual ( pathRes . descriptionMatch . length , 1 ) ;
206
+ assert . strictEqual ( pathRes . descriptionMatch [ 0 ] . start , 1 ) ;
207
+ assert . strictEqual ( pathRes . descriptionMatch [ 0 ] . end , 4 ) ;
208
208
209
209
// No Match
210
210
const noRes = scoreItem ( resource , '987' , true , ResourceAccessor ) ;
@@ -232,41 +232,41 @@ suite('Fuzzy Scorer', () => {
232
232
const res1 = scoreItem ( resource , 'xyz some' , true , ResourceAccessor ) ;
233
233
assert . ok ( res1 . score ) ;
234
234
assert . strictEqual ( res1 . labelMatch ?. length , 1 ) ;
235
- assert . strictEqual ( res1 . labelMatch ! [ 0 ] . start , 0 ) ;
236
- assert . strictEqual ( res1 . labelMatch ! [ 0 ] . end , 4 ) ;
235
+ assert . strictEqual ( res1 . labelMatch [ 0 ] . start , 0 ) ;
236
+ assert . strictEqual ( res1 . labelMatch [ 0 ] . end , 4 ) ;
237
237
assert . strictEqual ( res1 . descriptionMatch ?. length , 1 ) ;
238
- assert . strictEqual ( res1 . descriptionMatch ! [ 0 ] . start , 1 ) ;
239
- assert . strictEqual ( res1 . descriptionMatch ! [ 0 ] . end , 4 ) ;
238
+ assert . strictEqual ( res1 . descriptionMatch [ 0 ] . start , 1 ) ;
239
+ assert . strictEqual ( res1 . descriptionMatch [ 0 ] . end , 4 ) ;
240
240
241
241
const res2 = scoreItem ( resource , 'some xyz' , true , ResourceAccessor ) ;
242
242
assert . ok ( res2 . score ) ;
243
243
assert . strictEqual ( res1 . score , res2 . score ) ;
244
244
assert . strictEqual ( res2 . labelMatch ?. length , 1 ) ;
245
- assert . strictEqual ( res2 . labelMatch ! [ 0 ] . start , 0 ) ;
246
- assert . strictEqual ( res2 . labelMatch ! [ 0 ] . end , 4 ) ;
245
+ assert . strictEqual ( res2 . labelMatch [ 0 ] . start , 0 ) ;
246
+ assert . strictEqual ( res2 . labelMatch [ 0 ] . end , 4 ) ;
247
247
assert . strictEqual ( res2 . descriptionMatch ?. length , 1 ) ;
248
- assert . strictEqual ( res2 . descriptionMatch ! [ 0 ] . start , 1 ) ;
249
- assert . strictEqual ( res2 . descriptionMatch ! [ 0 ] . end , 4 ) ;
248
+ assert . strictEqual ( res2 . descriptionMatch [ 0 ] . start , 1 ) ;
249
+ assert . strictEqual ( res2 . descriptionMatch [ 0 ] . end , 4 ) ;
250
250
251
251
const res3 = scoreItem ( resource , 'some xyz file file123' , true , ResourceAccessor ) ;
252
252
assert . ok ( res3 . score ) ;
253
253
assert . ok ( res3 . score > res2 . score ) ;
254
254
assert . strictEqual ( res3 . labelMatch ?. length , 1 ) ;
255
- assert . strictEqual ( res3 . labelMatch ! [ 0 ] . start , 0 ) ;
256
- assert . strictEqual ( res3 . labelMatch ! [ 0 ] . end , 11 ) ;
255
+ assert . strictEqual ( res3 . labelMatch [ 0 ] . start , 0 ) ;
256
+ assert . strictEqual ( res3 . labelMatch [ 0 ] . end , 11 ) ;
257
257
assert . strictEqual ( res3 . descriptionMatch ?. length , 1 ) ;
258
- assert . strictEqual ( res3 . descriptionMatch ! [ 0 ] . start , 1 ) ;
259
- assert . strictEqual ( res3 . descriptionMatch ! [ 0 ] . end , 4 ) ;
258
+ assert . strictEqual ( res3 . descriptionMatch [ 0 ] . start , 1 ) ;
259
+ assert . strictEqual ( res3 . descriptionMatch [ 0 ] . end , 4 ) ;
260
260
261
261
const res4 = scoreItem ( resource , 'path z y' , true , ResourceAccessor ) ;
262
262
assert . ok ( res4 . score ) ;
263
263
assert . ok ( res4 . score < res2 . score ) ;
264
264
assert . strictEqual ( res4 . labelMatch ?. length , 0 ) ;
265
265
assert . strictEqual ( res4 . descriptionMatch ?. length , 2 ) ;
266
- assert . strictEqual ( res4 . descriptionMatch ! [ 0 ] . start , 2 ) ;
267
- assert . strictEqual ( res4 . descriptionMatch ! [ 0 ] . end , 4 ) ;
268
- assert . strictEqual ( res4 . descriptionMatch ! [ 1 ] . start , 10 ) ;
269
- assert . strictEqual ( res4 . descriptionMatch ! [ 1 ] . end , 14 ) ;
266
+ assert . strictEqual ( res4 . descriptionMatch [ 0 ] . start , 2 ) ;
267
+ assert . strictEqual ( res4 . descriptionMatch [ 0 ] . end , 4 ) ;
268
+ assert . strictEqual ( res4 . descriptionMatch [ 1 ] . start , 10 ) ;
269
+ assert . strictEqual ( res4 . descriptionMatch [ 1 ] . end , 14 ) ;
270
270
} ) ;
271
271
272
272
test ( 'scoreItem - multiple with cache yields different results' , function ( ) {
@@ -299,12 +299,12 @@ suite('Fuzzy Scorer', () => {
299
299
assert . ok ( pathRes . score ) ;
300
300
assert . ok ( pathRes . descriptionMatch ) ;
301
301
assert . ok ( pathRes . labelMatch ) ;
302
- assert . strictEqual ( pathRes . labelMatch ! . length , 1 ) ;
303
- assert . strictEqual ( pathRes . labelMatch ! [ 0 ] . start , 0 ) ;
304
- assert . strictEqual ( pathRes . labelMatch ! [ 0 ] . end , 7 ) ;
305
- assert . strictEqual ( pathRes . descriptionMatch ! . length , 1 ) ;
306
- assert . strictEqual ( pathRes . descriptionMatch ! [ 0 ] . start , 23 ) ;
307
- assert . strictEqual ( pathRes . descriptionMatch ! [ 0 ] . end , 26 ) ;
302
+ assert . strictEqual ( pathRes . labelMatch . length , 1 ) ;
303
+ assert . strictEqual ( pathRes . labelMatch [ 0 ] . start , 0 ) ;
304
+ assert . strictEqual ( pathRes . labelMatch [ 0 ] . end , 7 ) ;
305
+ assert . strictEqual ( pathRes . descriptionMatch . length , 1 ) ;
306
+ assert . strictEqual ( pathRes . descriptionMatch [ 0 ] . start , 23 ) ;
307
+ assert . strictEqual ( pathRes . descriptionMatch [ 0 ] . end , 26 ) ;
308
308
} ) ;
309
309
310
310
test ( 'scoreItem - avoid match scattering (bug #36119)' , function ( ) {
@@ -314,9 +314,9 @@ suite('Fuzzy Scorer', () => {
314
314
assert . ok ( pathRes . score ) ;
315
315
assert . ok ( pathRes . descriptionMatch ) ;
316
316
assert . ok ( pathRes . labelMatch ) ;
317
- assert . strictEqual ( pathRes . labelMatch ! . length , 1 ) ;
318
- assert . strictEqual ( pathRes . labelMatch ! [ 0 ] . start , 0 ) ;
319
- assert . strictEqual ( pathRes . labelMatch ! [ 0 ] . end , 9 ) ;
317
+ assert . strictEqual ( pathRes . labelMatch . length , 1 ) ;
318
+ assert . strictEqual ( pathRes . labelMatch [ 0 ] . start , 0 ) ;
319
+ assert . strictEqual ( pathRes . labelMatch [ 0 ] . end , 9 ) ;
320
320
} ) ;
321
321
322
322
test ( 'scoreItem - prefers more compact matches' , function ( ) {
@@ -328,11 +328,11 @@ suite('Fuzzy Scorer', () => {
328
328
assert . ok ( res . score ) ;
329
329
assert . ok ( res . descriptionMatch ) ;
330
330
assert . ok ( ! res . labelMatch ! . length ) ;
331
- assert . strictEqual ( res . descriptionMatch ! . length , 2 ) ;
332
- assert . strictEqual ( res . descriptionMatch ! [ 0 ] . start , 11 ) ;
333
- assert . strictEqual ( res . descriptionMatch ! [ 0 ] . end , 12 ) ;
334
- assert . strictEqual ( res . descriptionMatch ! [ 1 ] . start , 13 ) ;
335
- assert . strictEqual ( res . descriptionMatch ! [ 1 ] . end , 14 ) ;
331
+ assert . strictEqual ( res . descriptionMatch . length , 2 ) ;
332
+ assert . strictEqual ( res . descriptionMatch [ 0 ] . start , 11 ) ;
333
+ assert . strictEqual ( res . descriptionMatch [ 0 ] . end , 12 ) ;
334
+ assert . strictEqual ( res . descriptionMatch [ 1 ] . start , 13 ) ;
335
+ assert . strictEqual ( res . descriptionMatch [ 1 ] . end , 14 ) ;
336
336
} ) ;
337
337
338
338
test ( 'scoreItem - proper target offset' , function ( ) {
@@ -1121,7 +1121,7 @@ suite('Fuzzy Scorer', () => {
1121
1121
assert . strictEqual ( query . values ?. [ 1 ] . normalized , 'World' ) ;
1122
1122
assert . strictEqual ( query . values ?. [ 1 ] . normalizedLowercase , 'World' . toLowerCase ( ) ) ;
1123
1123
1124
- const restoredQuery = pieceToQuery ( query . values ! ) ;
1124
+ const restoredQuery = pieceToQuery ( query . values ) ;
1125
1125
assert . strictEqual ( restoredQuery . original , query . original ) ;
1126
1126
assert . strictEqual ( restoredQuery . values ?. length , query . values ?. length ) ;
1127
1127
assert . strictEqual ( restoredQuery . containsPathSeparator , query . containsPathSeparator ) ;
0 commit comments