@@ -70,14 +70,14 @@ describe('Service Module - Actions', () => {
70
70
const actions = mapActions ( 'todos' , [ 'find' ] )
71
71
72
72
assert ( todoState . ids . length === 0 , 'no ids before find' )
73
- assert ( todoState . errorOnFind === undefined , 'no error before find' )
73
+ assert ( todoState . errorOnFind === null , 'no error before find' )
74
74
assert ( todoState . isFindPending === false , 'isFindPending is false' )
75
75
assert ( todoState . idField === 'id' , 'idField is `id`' )
76
76
77
77
actions . find . call ( { $store : store } , { } )
78
78
. then ( response => {
79
79
assert ( todoState . ids . length === 10 , 'three ids populated' )
80
- assert ( todoState . errorOnFind === undefined , 'errorOnFind still undefined ' )
80
+ assert ( todoState . errorOnFind === null , 'errorOnFind still null ' )
81
81
assert ( todoState . isFindPending === false , 'isFindPending is false' )
82
82
let expectedKeyedById = makeStore ( )
83
83
assert . deepEqual ( todoState . keyedById , expectedKeyedById , 'keyedById matches' )
@@ -86,7 +86,7 @@ describe('Service Module - Actions', () => {
86
86
87
87
// Make sure proper state changes occurred before response
88
88
assert ( todoState . ids . length === 0 )
89
- assert ( todoState . errorOnFind === undefined )
89
+ assert ( todoState . errorOnFind === null )
90
90
assert ( todoState . isFindPending === true )
91
91
assert . deepEqual ( todoState . keyedById , { } )
92
92
} )
@@ -280,7 +280,7 @@ describe('Service Module - Actions', () => {
280
280
281
281
// Make sure proper state changes occurred before response
282
282
assert ( brokenState . ids . length === 0 )
283
- assert ( brokenState . errorOnFind === undefined )
283
+ assert ( brokenState . errorOnFind === null )
284
284
assert ( brokenState . isFindPending === true )
285
285
} )
286
286
} )
@@ -294,14 +294,14 @@ describe('Service Module - Actions', () => {
294
294
const actions = mapActions ( 'todos' , [ 'get' ] )
295
295
296
296
assert ( todoState . ids . length === 0 )
297
- assert ( todoState . errorOnGet === undefined )
297
+ assert ( todoState . errorOnGet === null )
298
298
assert ( todoState . isGetPending === false )
299
299
assert ( todoState . idField === 'id' )
300
300
301
301
actions . get . call ( { $store : store } , 0 )
302
302
. then ( response => {
303
303
assert ( todoState . ids . length === 1 , 'only one item is in the store' )
304
- assert ( todoState . errorOnGet === undefined , 'there was no errorOnGet' )
304
+ assert ( todoState . errorOnGet === null , 'there was no errorOnGet' )
305
305
assert ( todoState . isGetPending === false , 'isGetPending is set to false' )
306
306
let expectedKeyedById = {
307
307
0 : { id : 0 , description : 'Do the first' }
@@ -323,7 +323,7 @@ describe('Service Module - Actions', () => {
323
323
324
324
// Make sure proper state changes occurred before response
325
325
assert ( todoState . ids . length === 0 )
326
- assert ( todoState . errorOnCreate === undefined )
326
+ assert ( todoState . errorOnCreate === null )
327
327
assert ( todoState . isGetPending === true )
328
328
assert . deepEqual ( todoState . keyedById , { } )
329
329
} )
@@ -343,7 +343,7 @@ describe('Service Module - Actions', () => {
343
343
344
344
// Make sure proper state changes occurred before response
345
345
assert ( brokenState . ids . length === 0 )
346
- assert ( brokenState . errorOnGet === undefined )
346
+ assert ( brokenState . errorOnGet === null )
347
347
assert ( brokenState . isGetPending === true )
348
348
} )
349
349
} )
@@ -359,15 +359,15 @@ describe('Service Module - Actions', () => {
359
359
actions . create . call ( { $store : store } , { description : 'Do the second' } )
360
360
. then ( response => {
361
361
assert ( todoState . ids . length === 1 )
362
- assert ( todoState . errorOnCreate === undefined )
362
+ assert ( todoState . errorOnCreate === null )
363
363
assert ( todoState . isCreatePending === false )
364
364
assert . deepEqual ( todoState . keyedById [ response . id ] , response )
365
365
done ( )
366
366
} )
367
367
368
368
// Make sure proper state changes occurred before response
369
369
assert ( todoState . ids . length === 0 )
370
- assert ( todoState . errorOnCreate === undefined )
370
+ assert ( todoState . errorOnCreate === null )
371
371
assert ( todoState . isCreatePending === true )
372
372
assert ( todoState . idField === 'id' )
373
373
assert . deepEqual ( todoState . keyedById , { } )
@@ -388,7 +388,7 @@ describe('Service Module - Actions', () => {
388
388
389
389
// Make sure proper state changes occurred before response
390
390
assert ( brokenState . ids . length === 0 )
391
- assert ( brokenState . errorOnCreate === undefined )
391
+ assert ( brokenState . errorOnCreate === null )
392
392
assert ( brokenState . isCreatePending === true )
393
393
} )
394
394
} )
@@ -406,15 +406,15 @@ describe('Service Module - Actions', () => {
406
406
actions . update . call ( { $store : store } , [ 0 , { id : 0 , description : 'Do da dishuz' } ] )
407
407
. then ( responseFromUpdate => {
408
408
assert ( todoState . ids . length === 1 )
409
- assert ( todoState . errorOnUpdate === undefined )
409
+ assert ( todoState . errorOnUpdate === null )
410
410
assert ( todoState . isUpdatePending === false )
411
411
assert . deepEqual ( todoState . keyedById [ responseFromUpdate . id ] , responseFromUpdate )
412
412
done ( )
413
413
} )
414
414
415
415
// Make sure proper state changes occurred before response
416
416
assert ( todoState . ids . length === 1 )
417
- assert ( todoState . errorOnUpdate === undefined )
417
+ assert ( todoState . errorOnUpdate === null )
418
418
assert ( todoState . isUpdatePending === true )
419
419
assert ( todoState . idField === 'id' )
420
420
} )
@@ -438,7 +438,7 @@ describe('Service Module - Actions', () => {
438
438
439
439
// Make sure proper state changes occurred before response
440
440
assert ( brokenState . ids . length === 0 )
441
- assert ( brokenState . errorOnUpdate === undefined )
441
+ assert ( brokenState . errorOnUpdate === null )
442
442
assert ( brokenState . isUpdatePending === true )
443
443
} )
444
444
} )
@@ -456,15 +456,15 @@ describe('Service Module - Actions', () => {
456
456
actions . patch . call ( { $store : store } , [ 0 , { description : 'Write a Vue app' } ] )
457
457
. then ( responseFromPatch => {
458
458
assert ( todoState . ids . length === 1 )
459
- assert ( todoState . errorOnPatch === undefined )
459
+ assert ( todoState . errorOnPatch === null )
460
460
assert ( todoState . isPatchPending === false )
461
461
assert . deepEqual ( todoState . keyedById [ responseFromPatch . id ] , responseFromPatch )
462
462
done ( )
463
463
} )
464
464
465
465
// Make sure proper state changes occurred before response
466
466
assert ( todoState . ids . length === 1 )
467
- assert ( todoState . errorOnPatch === undefined )
467
+ assert ( todoState . errorOnPatch === null )
468
468
assert ( todoState . isPatchPending === true )
469
469
assert ( todoState . idField === 'id' )
470
470
} )
@@ -485,7 +485,7 @@ describe('Service Module - Actions', () => {
485
485
486
486
// Make sure proper state changes occurred before response
487
487
assert ( brokenState . ids . length === 0 )
488
- assert ( brokenState . errorOnPatch === undefined )
488
+ assert ( brokenState . errorOnPatch === null )
489
489
assert ( brokenState . isPatchPending === true )
490
490
} )
491
491
} )
@@ -503,15 +503,15 @@ describe('Service Module - Actions', () => {
503
503
actions . remove . call ( { $store : store } , 0 )
504
504
. then ( responseFromRemove => {
505
505
assert ( todoState . ids . length === 0 )
506
- assert ( todoState . errorOnRemove === undefined )
506
+ assert ( todoState . errorOnRemove === null )
507
507
assert ( todoState . isRemovePending === false )
508
508
assert . deepEqual ( todoState . keyedById , { } )
509
509
done ( )
510
510
} )
511
511
512
512
// Make sure proper state changes occurred before response
513
513
assert ( todoState . ids . length === 1 )
514
- assert ( todoState . errorOnRemove === undefined )
514
+ assert ( todoState . errorOnRemove === null )
515
515
assert ( todoState . isRemovePending === true )
516
516
assert ( todoState . idField === 'id' )
517
517
} )
@@ -532,7 +532,7 @@ describe('Service Module - Actions', () => {
532
532
533
533
// Make sure proper state changes occurred before response
534
534
assert ( brokenState . ids . length === 0 )
535
- assert ( brokenState . errorOnRemove === undefined )
535
+ assert ( brokenState . errorOnRemove === null )
536
536
assert ( brokenState . isRemovePending === true )
537
537
} )
538
538
} )
0 commit comments