Skip to content

Commit 00dccef

Browse files
committed
Better tests
1 parent fa0b164 commit 00dccef

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

test/integration/VuexORMApollo.spec.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,27 +377,39 @@ mutation SignupUser($user: UserInput!, $captchaToken: String!) {
377377

378378
describe('$isDirty', () => {
379379
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);
381384
expect(user.$isDirty).toBeFalsy();
382385
});
383386

384387
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' });
386389
user.name = 'Snoop Dog';
387390
expect(user.$isDirty).toBeTruthy();
391+
392+
user = store.getters['entities/users/find'](user.id);
393+
expect(user.$isDirty).toBeFalsy();
388394
});
389395

390396
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' });
392398
user.name = 'Snoop Dog';
393399
store.dispatch('entities/users/update', { where: user.id, data: user });
394400
expect(user.$isDirty).toBeFalsy();
401+
402+
user = store.getters['entities/users/find'](user.id);
403+
expect(user.$isDirty).toBeFalsy();
395404
});
396405
});
397406

398407
describe('$isPersisted', () => {
399408
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);
401413
expect(user.$isPersisted).toBeFalsy();
402414
});
403415

0 commit comments

Comments
 (0)