@@ -271,7 +271,6 @@ promisedTest("optimistic updates that eventually fail must be reverted (Issue #1
271
271
let abbaKey = 0 ;
272
272
let lastFriendId = 0 ;
273
273
let barbarFriendId = 0 ;
274
- let fruitCount = 0 ; // A bug in Safari <= 13.1 makes it unable to count on the name index (adds 1 extra)
275
274
const bulkFriends = [ ] ;
276
275
for ( let i = 0 ; i < 51 ; ++ i ) {
277
276
bulkFriends . push ( { name : `name${ i } ` , age : i } ) ;
@@ -294,7 +293,7 @@ const mutsAndExpects = () => [
294
293
itemsStartsWithAPrimKeys : [ - 1 ] ,
295
294
itemsStartsWithAOffset3 : [ ] ,
296
295
itemsStartsWithAKeys : [ "A" ] ,
297
- itemsStartsWithACount : fruitCount + 1
296
+ itemsStartsWithACount : 1
298
297
}
299
298
] ,
300
299
// addAuto
@@ -342,7 +341,7 @@ const mutsAndExpects = () => [
342
341
itemsStartsWithAPrimKeys : [ ] ,
343
342
itemsStartsWithAOffset3 : [ ] ,
344
343
itemsStartsWithAKeys : [ ] ,
345
- itemsStartsWithACount : fruitCount
344
+ itemsStartsWithACount : 0
346
345
}
347
346
] ,
348
347
[
@@ -355,7 +354,7 @@ const mutsAndExpects = () => [
355
354
itemsStartsWithAPrimKeys : [ - 1 ] ,
356
355
itemsStartsWithAOffset3 : [ ] ,
357
356
itemsStartsWithAKeys : [ "A" ] ,
358
- itemsStartsWithACount : fruitCount + 1
357
+ itemsStartsWithACount : 1
359
358
}
360
359
] ,
361
360
// add again
@@ -367,7 +366,7 @@ const mutsAndExpects = () => [
367
366
itemsStartsWithAPrimKeys : [ - 1 , 4 , 6 , 5 ] ,
368
367
itemsStartsWithAOffset3 : [ { id : 5 , name : "Assot" } ] , // offset 3
369
368
itemsStartsWithAKeys : [ "A" , "Abbot" , "Ambros" , "Assot" ] ,
370
- itemsStartsWithACount : fruitCount + 4
369
+ itemsStartsWithACount : 4
371
370
}
372
371
] ,
373
372
// delete:
@@ -381,7 +380,7 @@ const mutsAndExpects = () => [
381
380
itemsStartsWithA : [ { id : 4 , name : "Abbot" } , { id : 6 , name : "Ambros" } , { id : 5 , name : "Assot" } ] ,
382
381
itemsStartsWithAPrimKeys : [ 4 , 6 , 5 ] ,
383
382
itemsStartsWithAKeys : [ "Abbot" , "Ambros" , "Assot" ] ,
384
- itemsStartsWithACount : fruitCount + 3
383
+ itemsStartsWithACount : 3
385
384
} ,
386
385
// Allowed extras:
387
386
// If hooks is listened to we'll get an even more correct update of the itemsStartsWithAOffset3 query
@@ -400,7 +399,7 @@ const mutsAndExpects = () => [
400
399
} , {
401
400
// Things that optionally can be matched in result (if no hooks specified):
402
401
itemsStartsWithAPrimKeys : [ 4 , 6 , 5 ] ,
403
- itemsStartsWithACount : fruitCount + 3 ,
402
+ itemsStartsWithACount : 3 ,
404
403
itemsStartsWithAOffset3 : [ ]
405
404
}
406
405
] ,
@@ -413,7 +412,7 @@ const mutsAndExpects = () => [
413
412
itemsStartsWithA : [ { id : 4 , name : "Abbot" } , { id : 6 , name : "Ambros" } ] ,
414
413
itemsStartsWithAPrimKeys : [ 4 , 6 ] ,
415
414
itemsStartsWithAKeys : [ "Abbot" , "Ambros" ] ,
416
- itemsStartsWithACount : fruitCount + 2
415
+ itemsStartsWithACount : 2
417
416
} , {
418
417
itemsStartsWithAOffset3 : [ ] // This is
419
418
}
@@ -543,20 +542,26 @@ const mutsAndExpects = () => [
543
542
]
544
543
}
545
544
] ,
545
+ // Issue 2011 / 2012
546
+ [
547
+ ( ) => db . items . bulkPut ( [
548
+ { id : 6 , name : "One" } ,
549
+ { id : 6 , name : "Two" } ,
550
+ { id : 6 , name : "Three" }
551
+ ] ) ,
552
+ {
553
+ itemsToArray : [ { id :1 } , { id :2 } , { id :3 } , { id :4 , name :"Abbot" } , { id :6 , name :"Three" } ] ,
554
+ itemsStartsWithA : [ { id : 4 , name : "Abbot" } ] ,
555
+ itemsStartsWithAPrimKeys : [ 4 ] ,
556
+ itemsStartsWithAKeys : [ "Abbot" ] ,
557
+ itemsStartsWithACount : 1
558
+ } , [
559
+ "itemsStartsWithAOffset3" // Should not be updated but need to be ignored because otherwise it fails in dexie-syncable's integration tests that expects it to update to another empty array
560
+ ]
561
+ ] ,
546
562
]
547
563
548
564
promisedTest ( "Full use case matrix" , async ( ) => {
549
- // A bug in Safari <= 13.1 makes it unable to count on the name index (adds 1 extra)
550
- fruitCount = await db . items . where ( 'name' ) . startsWith ( 'A' ) . count ( ) ;
551
- if ( fruitCount > 0 ) console . log ( "fruitCount: " + fruitCount ) ;
552
-
553
- if ( isIE ) {
554
- // The IE implementation becomes shaky here.
555
- // Maybe becuase we launch several parallel queries to IDB.
556
- ok ( true , "Skipping this test for IE - too shaky for the CI" ) ;
557
- return ;
558
- }
559
-
560
565
const queries = {
561
566
itemsToArray : ( ) => db . items . toArray ( ) ,
562
567
itemsGet1And2 : ( ) => Promise . all ( db . items . get ( 1 ) , db . items . get ( - 1 ) ) ,
@@ -591,7 +596,7 @@ promisedTest("Full use case matrix", async ()=>{
591
596
itemsStartsWithAPrimKeys : [ ] ,
592
597
itemsStartsWithAOffset3 : [ ] ,
593
598
itemsStartsWithAKeys : [ ] ,
594
- itemsStartsWithACount : fruitCount ,
599
+ itemsStartsWithACount : 0 ,
595
600
596
601
outboundToArray : [
597
602
{ num : 1 , name : "A" } ,
0 commit comments