diff options
Diffstat (limited to 'test/unit/specs/modules/users.spec.js')
| -rw-r--r-- | test/unit/specs/modules/users.spec.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/specs/modules/users.spec.js b/test/unit/specs/modules/users.spec.js new file mode 100644 index 00000000..07c71e32 --- /dev/null +++ b/test/unit/specs/modules/users.spec.js @@ -0,0 +1,20 @@ +import { cloneDeep } from 'lodash' + +import { defaultState, mutations } from '../../../../src/modules/users.js' + +describe('The users module', () => { + it('adds new users to the set, merging in new information for old users', () => { + const state = cloneDeep(defaultState) + const user = { id: 1, name: 'Guy' } + const modUser = { id: 1, name: 'Dude' } + + mutations.addNewUsers(state, [user]) + expect(state.users).to.have.length(1) + expect(state.users).to.eql([user]) + + mutations.addNewUsers(state, [modUser]) + expect(state.users).to.have.length(1) + expect(state.users).to.eql([user]) + expect(state.users[0].name).to.eql('Dude') + }) +}) |
