@@ -21,7 +21,7 @@ const options = {
21
21
service : null
22
22
}
23
23
24
- const { find, count, list, get, getCopyById, isCreatePendingById, isUpdatePendingById, isPatchPendingById, isRemovePendingById, isPendingById } = makeServiceGetters ( )
24
+ const { find, count, list, get, getCopyById, isCreatePendingById, isUpdatePendingById, isPatchPendingById, isRemovePendingById, isSavePendingById , isPendingById } = makeServiceGetters ( )
25
25
const { addItems, setIdPending, unsetIdPending } = makeServiceMutations ( )
26
26
27
27
describe ( 'Service Module - Getters' , function ( ) {
@@ -406,60 +406,80 @@ describe('Service Module - Getters', function () {
406
406
407
407
it ( 'is*PendingById' , function ( ) {
408
408
const { state } = this
409
- const getters = { isCreatePendingById, isUpdatePendingById, isPatchPendingById, isRemovePendingById }
409
+
410
+ // Set up getters
411
+ const getters : any = {
412
+ isCreatePendingById : isCreatePendingById ( state ) ,
413
+ isUpdatePendingById : isUpdatePendingById ( state ) ,
414
+ isPatchPendingById : isPatchPendingById ( state ) ,
415
+ isRemovePendingById : isRemovePendingById ( state ) ,
416
+ isSavePendingById,
417
+ isPendingById
418
+ }
419
+ getters . isSavePendingById = isSavePendingById ( state , getters )
420
+ getters . isPendingById = isPendingById ( state , getters )
410
421
411
422
assert ( isCreatePendingById ( state ) ( 42 ) === false , 'creating status is clear' )
412
423
assert ( isUpdatePendingById ( state ) ( 42 ) === false , 'updating status is clear' )
413
424
assert ( isPatchPendingById ( state ) ( 42 ) === false , 'patching status is clear' )
414
425
assert ( isRemovePendingById ( state ) ( 42 ) === false , 'removing status is clear' )
415
- assert ( isPendingById ( state , getters ) ( 42 ) , 'any method pending status is clear' )
426
+ assert ( isSavePendingById ( state , getters ) ( 42 ) === false , 'saving status is clear' )
427
+ assert ( isPendingById ( state , getters ) ( 42 ) === false , 'any method pending status is clear' )
416
428
417
429
// Create
418
430
setIdPending ( state , { method : 'create' , id : 42 } )
419
431
assert ( isCreatePendingById ( state ) ( 42 ) === true , 'creating status is set' )
420
- assert ( isPendingById ( state , getters ) ( 42 ) , 'any method pending status is set' )
432
+ assert ( isSavePendingById ( state , getters ) ( 42 ) === true , 'saving status is set' )
433
+ assert ( isPendingById ( state , getters ) ( 42 ) === true , 'any method pending status is set' )
421
434
422
435
unsetIdPending ( state , { method : 'create' , id : 42 } )
423
436
assert ( isCreatePendingById ( state ) ( 42 ) === false , 'creating status is clear' )
424
437
assert ( isUpdatePendingById ( state ) ( 42 ) === false , 'updating status is clear' )
425
438
assert ( isPatchPendingById ( state ) ( 42 ) === false , 'patching status is clear' )
426
439
assert ( isRemovePendingById ( state ) ( 42 ) === false , 'removing status is clear' )
427
- assert ( isPendingById ( state , getters ) ( 42 ) , 'any method pending status is clear' )
440
+ assert ( isSavePendingById ( state , getters ) ( 42 ) === false , 'saving status is clear' )
441
+ assert ( isPendingById ( state , getters ) ( 42 ) === false , 'any method pending status is clear' )
428
442
429
443
// Update
430
444
setIdPending ( state , { method : 'update' , id : 42 } )
431
445
assert ( isUpdatePendingById ( state ) ( 42 ) === true , 'updating status is set' )
432
- assert ( isPendingById ( state , getters ) ( 42 ) , 'any method pending status is set' )
446
+ assert ( isSavePendingById ( state , getters ) ( 42 ) === true , 'saving status is set' )
447
+ assert ( isPendingById ( state , getters ) ( 42 ) === true , 'any method pending status is set' )
433
448
434
449
unsetIdPending ( state , { method : 'update' , id : 42 } )
435
450
assert ( isCreatePendingById ( state ) ( 42 ) === false , 'creating status is clear' )
436
451
assert ( isUpdatePendingById ( state ) ( 42 ) === false , 'updating status is clear' )
437
452
assert ( isPatchPendingById ( state ) ( 42 ) === false , 'patching status is clear' )
438
453
assert ( isRemovePendingById ( state ) ( 42 ) === false , 'removing status is clear' )
439
- assert ( isPendingById ( state , getters ) ( 42 ) , 'any method pending status is clear' )
454
+ assert ( isSavePendingById ( state , getters ) ( 42 ) === false , 'saving status is clear' )
455
+ assert ( isPendingById ( state , getters ) ( 42 ) === false , 'any method pending status is clear' )
440
456
441
457
// Patch
442
458
setIdPending ( state , { method : 'patch' , id : 42 } )
443
459
assert ( isPatchPendingById ( state ) ( 42 ) === true , 'patching status is set' )
444
- assert ( isPendingById ( state , getters ) ( 42 ) , 'any method pending status is set' )
460
+ assert ( isSavePendingById ( state , getters ) ( 42 ) === true , 'saving status is set' )
461
+ assert ( isPendingById ( state , getters ) ( 42 ) === true , 'any method pending status is set' )
445
462
446
463
unsetIdPending ( state , { method : 'patch' , id : 42 } )
447
464
assert ( isCreatePendingById ( state ) ( 42 ) === false , 'creating status is clear' )
448
465
assert ( isUpdatePendingById ( state ) ( 42 ) === false , 'updating status is clear' )
449
466
assert ( isPatchPendingById ( state ) ( 42 ) === false , 'patching status is clear' )
450
467
assert ( isRemovePendingById ( state ) ( 42 ) === false , 'removing status is clear' )
451
- assert ( isPendingById ( state , getters ) ( 42 ) , 'any method pending status is clear' )
468
+ assert ( isSavePendingById ( state , getters ) ( 42 ) === false , 'saving status is clear' )
469
+ assert ( isPendingById ( state , getters ) ( 42 ) === false , 'any method pending status is clear' )
452
470
453
471
// Remove
454
472
setIdPending ( state , { method : 'remove' , id : 42 } )
455
473
assert ( isRemovePendingById ( state ) ( 42 ) === true , 'removing status is set' )
456
- assert ( isPendingById ( state , getters ) ( 42 ) , 'any method pending status is set' )
474
+ assert ( isSavePendingById ( state , getters ) ( 42 ) === false , 'saving status is clear for remove' )
475
+ assert ( isPendingById ( state , getters ) ( 42 ) === true , 'any method pending status is set' )
457
476
458
477
unsetIdPending ( state , { method : 'remove' , id : 42 } )
459
478
assert ( isCreatePendingById ( state ) ( 42 ) === false , 'creating status is clear' )
460
479
assert ( isUpdatePendingById ( state ) ( 42 ) === false , 'updating status is clear' )
461
480
assert ( isPatchPendingById ( state ) ( 42 ) === false , 'patching status is clear' )
462
481
assert ( isRemovePendingById ( state ) ( 42 ) === false , 'removing status is clear' )
463
- assert ( isPendingById ( state , getters ) ( 42 ) , 'any method pending status is clear' )
482
+ assert ( isSavePendingById ( state , getters ) ( 42 ) === false , 'saving status is clear' )
483
+ assert ( isPendingById ( state , getters ) ( 42 ) === false , 'any method pending status is clear' )
464
484
} )
465
485
} )
0 commit comments