File tree 1 file changed +19
-10
lines changed
examples/blogs__vue-vuex-rest/cypress/e2e
1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -350,16 +350,25 @@ describe('Store actions', () => {
350
350
351
351
getStore ( )
352
352
. its ( 'state' )
353
- . should ( 'deep.equal' , {
354
- loading : false ,
355
- todos : [
356
- {
357
- title : 'a new todo' ,
358
- completed : false ,
359
- id : '1' ,
360
- } ,
361
- ] ,
362
- newTodo : '' ,
353
+ . should ( ( state ) => {
354
+ // The vue store returns a proxy object, with getters over the various props.
355
+ // _.deepClone() resolves these getters into a primitive object, so we can
356
+ // assert on the values directly.
357
+
358
+ // It's important to us a callback form of .should() here, rather than
359
+ // .then(Cypress._.deepClone()), because .then() doesn't retry. See
360
+ // https://on.cypress.io/should#Function for a fuller explanation.
361
+ expect ( Cypress . _ . cloneDeep ( state ) ) . to . deep . equal ( {
362
+ loading : false ,
363
+ todos : [
364
+ {
365
+ title : 'a new todo' ,
366
+ completed : false ,
367
+ id : '1' ,
368
+ } ,
369
+ ] ,
370
+ newTodo : '' ,
371
+ } )
363
372
} )
364
373
} )
365
374
You can’t perform that action at this time.
0 commit comments