@@ -377,27 +377,39 @@ mutation SignupUser($user: UserInput!, $captchaToken: String!) {
377
377
378
378
describe ( '$isDirty' , ( ) => {
379
379
it ( 'is false for newly created records' , async ( ) => {
380
- const user = store . dispatch ( 'entities/users/create' , { name : 'Snoopy' } ) ;
380
+ let user = store . dispatch ( 'entities/users/create' , { name : 'Snoopy' } ) ;
381
+ expect ( user . $isDirty ) . toBeFalsy ( ) ;
382
+
383
+ user = store . getters [ 'entities/users/find' ] ( user . id ) ;
381
384
expect ( user . $isDirty ) . toBeFalsy ( ) ;
382
385
} ) ;
383
386
384
387
it ( 'is true for changed but unsaved records' , async ( ) => {
385
- const user = store . dispatch ( 'entities/users/create' , { name : 'Snoopy' } ) ;
388
+ let user = store . dispatch ( 'entities/users/create' , { name : 'Snoopy' } ) ;
386
389
user . name = 'Snoop Dog' ;
387
390
expect ( user . $isDirty ) . toBeTruthy ( ) ;
391
+
392
+ user = store . getters [ 'entities/users/find' ] ( user . id ) ;
393
+ expect ( user . $isDirty ) . toBeFalsy ( ) ;
388
394
} ) ;
389
395
390
396
it ( 'is false for changed and saved records' , async ( ) => {
391
- const user = store . dispatch ( 'entities/users/create' , { name : 'Snoopy' } ) ;
397
+ let user = store . dispatch ( 'entities/users/create' , { name : 'Snoopy' } ) ;
392
398
user . name = 'Snoop Dog' ;
393
399
store . dispatch ( 'entities/users/update' , { where : user . id , data : user } ) ;
394
400
expect ( user . $isDirty ) . toBeFalsy ( ) ;
401
+
402
+ user = store . getters [ 'entities/users/find' ] ( user . id ) ;
403
+ expect ( user . $isDirty ) . toBeFalsy ( ) ;
395
404
} ) ;
396
405
} ) ;
397
406
398
407
describe ( '$isPersisted' , ( ) => {
399
408
it ( 'is false for newly created records' , async ( ) => {
400
- const user = store . dispatch ( 'entities/users/create' , { name : 'Snoopy' } ) ;
409
+ let user = store . dispatch ( 'entities/users/create' , { name : 'Snoopy' } ) ;
410
+ expect ( user . $isPersisted ) . toBeFalsy ( ) ;
411
+
412
+ user = store . getters [ 'entities/users/find' ] ( user . id ) ;
401
413
expect ( user . $isPersisted ) . toBeFalsy ( ) ;
402
414
} ) ;
403
415
0 commit comments