Skip to content

Commit 16601a4

Browse files
committed
Update tests
1 parent 100d4ca commit 16601a4

File tree

6 files changed

+54
-53
lines changed

6 files changed

+54
-53
lines changed

test/auth-module/actions.test.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ describe('Auth Module - Actions', () => {
2323
const authState = store.state.auth
2424
const actions = mapActions('auth', ['authenticate'])
2525

26-
assert(authState.accessToken === undefined)
27-
assert(authState.errorOnAuthenticate === undefined)
28-
assert(authState.errorOnLogout === undefined)
26+
assert(authState.accessToken === null)
27+
assert(authState.errorOnAuthenticate === null)
28+
assert(authState.errorOnLogout === null)
2929
assert(authState.isAuthenticatePending === false)
3030
assert(authState.isLogoutPending === false)
31-
assert(authState.payload === undefined)
31+
assert(authState.payload === null)
3232

3333
const request = {strategy: 'local', email: 'test', password: 'test'}
3434
actions.authenticate.call({$store: store}, request)
3535
.then(response => {
3636
assert(authState.accessToken === response.accessToken)
37-
assert(authState.errorOnAuthenticate === undefined)
38-
assert(authState.errorOnLogout === undefined)
37+
assert(authState.errorOnAuthenticate === null)
38+
assert(authState.errorOnLogout === null)
3939
assert(authState.isAuthenticatePending === false)
4040
assert(authState.isLogoutPending === false)
4141
let expectedPayload = {
@@ -47,12 +47,12 @@ describe('Auth Module - Actions', () => {
4747
})
4848

4949
// Make sure proper state changes occurred before response
50-
assert(authState.accessToken === undefined)
51-
assert(authState.errorOnAuthenticate === undefined)
52-
assert(authState.errorOnLogout === undefined)
50+
assert(authState.accessToken === null)
51+
assert(authState.errorOnAuthenticate === null)
52+
assert(authState.errorOnLogout === null)
5353
assert(authState.isAuthenticatePending === true)
5454
assert(authState.isLogoutPending === false)
55-
assert(authState.payload === undefined)
55+
assert(authState.payload === null)
5656
})
5757

5858
it('Logout', (done) => {
@@ -73,12 +73,12 @@ describe('Auth Module - Actions', () => {
7373
.then(authResponse => {
7474
actions.logout.call({$store: store})
7575
.then(response => {
76-
assert(authState.accessToken === undefined)
77-
assert(authState.errorOnAuthenticate === undefined)
78-
assert(authState.errorOnLogout === undefined)
76+
assert(authState.accessToken === null)
77+
assert(authState.errorOnAuthenticate === null)
78+
assert(authState.errorOnLogout === null)
7979
assert(authState.isAuthenticatePending === false)
8080
assert(authState.isLogoutPending === false)
81-
assert(authState.payload === undefined)
81+
assert(authState.payload === null)
8282
done()
8383
})
8484
})
@@ -101,7 +101,7 @@ describe('Auth Module - Actions', () => {
101101
const authState = store.state.auth
102102
const actions = mapActions('auth', ['authenticate'])
103103

104-
assert(authState.user === undefined)
104+
assert(authState.user === null)
105105

106106
const request = {strategy: 'local', email: 'test', password: 'test'}
107107
actions.authenticate.call({$store: store}, request)

test/auth-module/auth-module.test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ describe('Auth Module', () => {
1515
})
1616
const authState = store.state.auth
1717
const expectedAuthState = {
18-
accessToken: undefined,
19-
errorOnAuthenticate: undefined,
20-
errorOnLogout: undefined,
18+
accessToken: null,
19+
errorOnAuthenticate: null,
20+
errorOnLogout: null,
2121
isAuthenticatePending: false,
2222
isLogoutPending: false,
23-
payload: undefined
23+
payload: null,
24+
user: null
2425
}
2526

2627
assert.deepEqual(authState, expectedAuthState, 'has the default state')

test/auth.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe('feathers-vuex:auth - Reducer', () => {
8888
isPending: false,
8989
isError: false,
9090
isSignedIn: false,
91-
accessToken: undefined,
91+
accessToken: null,
9292
error: undefined
9393
}
9494
const newState = reducer(state, {})
@@ -108,7 +108,7 @@ describe('feathers-vuex:auth - Reducer', () => {
108108
isPending: true,
109109
isError: false,
110110
isSignedIn: false,
111-
accessToken: undefined,
111+
accessToken: null,
112112
error: undefined
113113
}
114114
const newState = reducer(state, action)
@@ -144,7 +144,7 @@ describe('feathers-vuex:auth - Reducer', () => {
144144
isPending: false,
145145
isError: true,
146146
isSignedIn: false,
147-
accessToken: undefined,
147+
accessToken: null,
148148
error
149149
}
150150
const newState = reducer(state, action)
@@ -160,7 +160,7 @@ describe('feathers-vuex:auth - Reducer', () => {
160160
isPending: false,
161161
isError: false,
162162
isSignedIn: false,
163-
accessToken: undefined,
163+
accessToken: null,
164164
error: undefined
165165
}
166166
const newState = reducer(state, action)

test/service-module/actions.test.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ describe('Service Module - Actions', () => {
7070
const actions = mapActions('todos', ['find'])
7171

7272
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')
7474
assert(todoState.isFindPending === false, 'isFindPending is false')
7575
assert(todoState.idField === 'id', 'idField is `id`')
7676

7777
actions.find.call({$store: store}, {})
7878
.then(response => {
7979
assert(todoState.ids.length === 10, 'three ids populated')
80-
assert(todoState.errorOnFind === undefined, 'errorOnFind still undefined')
80+
assert(todoState.errorOnFind === null, 'errorOnFind still null')
8181
assert(todoState.isFindPending === false, 'isFindPending is false')
8282
let expectedKeyedById = makeStore()
8383
assert.deepEqual(todoState.keyedById, expectedKeyedById, 'keyedById matches')
@@ -86,7 +86,7 @@ describe('Service Module - Actions', () => {
8686

8787
// Make sure proper state changes occurred before response
8888
assert(todoState.ids.length === 0)
89-
assert(todoState.errorOnFind === undefined)
89+
assert(todoState.errorOnFind === null)
9090
assert(todoState.isFindPending === true)
9191
assert.deepEqual(todoState.keyedById, {})
9292
})
@@ -280,7 +280,7 @@ describe('Service Module - Actions', () => {
280280

281281
// Make sure proper state changes occurred before response
282282
assert(brokenState.ids.length === 0)
283-
assert(brokenState.errorOnFind === undefined)
283+
assert(brokenState.errorOnFind === null)
284284
assert(brokenState.isFindPending === true)
285285
})
286286
})
@@ -294,14 +294,14 @@ describe('Service Module - Actions', () => {
294294
const actions = mapActions('todos', ['get'])
295295

296296
assert(todoState.ids.length === 0)
297-
assert(todoState.errorOnGet === undefined)
297+
assert(todoState.errorOnGet === null)
298298
assert(todoState.isGetPending === false)
299299
assert(todoState.idField === 'id')
300300

301301
actions.get.call({$store: store}, 0)
302302
.then(response => {
303303
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')
305305
assert(todoState.isGetPending === false, 'isGetPending is set to false')
306306
let expectedKeyedById = {
307307
0: { id: 0, description: 'Do the first' }
@@ -323,7 +323,7 @@ describe('Service Module - Actions', () => {
323323

324324
// Make sure proper state changes occurred before response
325325
assert(todoState.ids.length === 0)
326-
assert(todoState.errorOnCreate === undefined)
326+
assert(todoState.errorOnCreate === null)
327327
assert(todoState.isGetPending === true)
328328
assert.deepEqual(todoState.keyedById, {})
329329
})
@@ -343,7 +343,7 @@ describe('Service Module - Actions', () => {
343343

344344
// Make sure proper state changes occurred before response
345345
assert(brokenState.ids.length === 0)
346-
assert(brokenState.errorOnGet === undefined)
346+
assert(brokenState.errorOnGet === null)
347347
assert(brokenState.isGetPending === true)
348348
})
349349
})
@@ -359,15 +359,15 @@ describe('Service Module - Actions', () => {
359359
actions.create.call({$store: store}, {description: 'Do the second'})
360360
.then(response => {
361361
assert(todoState.ids.length === 1)
362-
assert(todoState.errorOnCreate === undefined)
362+
assert(todoState.errorOnCreate === null)
363363
assert(todoState.isCreatePending === false)
364364
assert.deepEqual(todoState.keyedById[response.id], response)
365365
done()
366366
})
367367

368368
// Make sure proper state changes occurred before response
369369
assert(todoState.ids.length === 0)
370-
assert(todoState.errorOnCreate === undefined)
370+
assert(todoState.errorOnCreate === null)
371371
assert(todoState.isCreatePending === true)
372372
assert(todoState.idField === 'id')
373373
assert.deepEqual(todoState.keyedById, {})
@@ -388,7 +388,7 @@ describe('Service Module - Actions', () => {
388388

389389
// Make sure proper state changes occurred before response
390390
assert(brokenState.ids.length === 0)
391-
assert(brokenState.errorOnCreate === undefined)
391+
assert(brokenState.errorOnCreate === null)
392392
assert(brokenState.isCreatePending === true)
393393
})
394394
})
@@ -406,15 +406,15 @@ describe('Service Module - Actions', () => {
406406
actions.update.call({$store: store}, [0, {id: 0, description: 'Do da dishuz'}])
407407
.then(responseFromUpdate => {
408408
assert(todoState.ids.length === 1)
409-
assert(todoState.errorOnUpdate === undefined)
409+
assert(todoState.errorOnUpdate === null)
410410
assert(todoState.isUpdatePending === false)
411411
assert.deepEqual(todoState.keyedById[responseFromUpdate.id], responseFromUpdate)
412412
done()
413413
})
414414

415415
// Make sure proper state changes occurred before response
416416
assert(todoState.ids.length === 1)
417-
assert(todoState.errorOnUpdate === undefined)
417+
assert(todoState.errorOnUpdate === null)
418418
assert(todoState.isUpdatePending === true)
419419
assert(todoState.idField === 'id')
420420
})
@@ -438,7 +438,7 @@ describe('Service Module - Actions', () => {
438438

439439
// Make sure proper state changes occurred before response
440440
assert(brokenState.ids.length === 0)
441-
assert(brokenState.errorOnUpdate === undefined)
441+
assert(brokenState.errorOnUpdate === null)
442442
assert(brokenState.isUpdatePending === true)
443443
})
444444
})
@@ -456,15 +456,15 @@ describe('Service Module - Actions', () => {
456456
actions.patch.call({$store: store}, [0, {description: 'Write a Vue app'}])
457457
.then(responseFromPatch => {
458458
assert(todoState.ids.length === 1)
459-
assert(todoState.errorOnPatch === undefined)
459+
assert(todoState.errorOnPatch === null)
460460
assert(todoState.isPatchPending === false)
461461
assert.deepEqual(todoState.keyedById[responseFromPatch.id], responseFromPatch)
462462
done()
463463
})
464464

465465
// Make sure proper state changes occurred before response
466466
assert(todoState.ids.length === 1)
467-
assert(todoState.errorOnPatch === undefined)
467+
assert(todoState.errorOnPatch === null)
468468
assert(todoState.isPatchPending === true)
469469
assert(todoState.idField === 'id')
470470
})
@@ -485,7 +485,7 @@ describe('Service Module - Actions', () => {
485485

486486
// Make sure proper state changes occurred before response
487487
assert(brokenState.ids.length === 0)
488-
assert(brokenState.errorOnPatch === undefined)
488+
assert(brokenState.errorOnPatch === null)
489489
assert(brokenState.isPatchPending === true)
490490
})
491491
})
@@ -503,15 +503,15 @@ describe('Service Module - Actions', () => {
503503
actions.remove.call({$store: store}, 0)
504504
.then(responseFromRemove => {
505505
assert(todoState.ids.length === 0)
506-
assert(todoState.errorOnRemove === undefined)
506+
assert(todoState.errorOnRemove === null)
507507
assert(todoState.isRemovePending === false)
508508
assert.deepEqual(todoState.keyedById, {})
509509
done()
510510
})
511511

512512
// Make sure proper state changes occurred before response
513513
assert(todoState.ids.length === 1)
514-
assert(todoState.errorOnRemove === undefined)
514+
assert(todoState.errorOnRemove === null)
515515
assert(todoState.isRemovePending === true)
516516
assert(todoState.idField === 'id')
517517
})
@@ -532,7 +532,7 @@ describe('Service Module - Actions', () => {
532532

533533
// Make sure proper state changes occurred before response
534534
assert(brokenState.ids.length === 0)
535-
assert(brokenState.errorOnRemove === undefined)
535+
assert(brokenState.errorOnRemove === null)
536536
assert(brokenState.isRemovePending === true)
537537
})
538538
})

test/service-module/mutations.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ describe('Service Module - Mutations', function () {
271271
setCurrent(state, item2)
272272
clearCurrent(state)
273273

274-
assert(state.currentId === undefined)
275-
assert(state.copy === undefined)
274+
assert(state.currentId === null)
275+
assert(state.copy === null)
276276
})
277277

278278
it('copy works', function () {

test/service-module/service-module.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ describe('Service Module', () => {
105105
const todoState = store.state.todos
106106
const expectedState = {
107107
autoRemove: false,
108-
copy: undefined,
109-
currentId: undefined,
110-
errorOnCreate: undefined,
111-
errorOnGet: undefined,
112-
errorOnPatch: undefined,
113-
errorOnRemove: undefined,
114-
errorOnUpdate: undefined,
115-
errorOnFind: undefined,
108+
copy: null,
109+
currentId: null,
110+
errorOnCreate: null,
111+
errorOnGet: null,
112+
errorOnPatch: null,
113+
errorOnRemove: null,
114+
errorOnUpdate: null,
115+
errorOnFind: null,
116116
idField: 'id',
117117
ids: [],
118118
isFindPending: false,

0 commit comments

Comments
 (0)