diff options
author | Devlin Junker <devlin.junker@gmail.com> | 2023-10-05 10:27:26 -0700 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2023-10-06 08:18:41 +0200 |
commit | 991facf2ee638713d2f2ef8b5197f32742d01804 (patch) | |
tree | f7da3576d44a76ce76ab28ca66d70d861d4aa24c /tests/javascript/unit/store | |
parent | 498c001bd35553d68b9332a971fd22afccdfdefa (diff) |
tests and some cleanup
Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
Diffstat (limited to 'tests/javascript/unit/store')
-rw-r--r-- | tests/javascript/unit/store/app.spec.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/javascript/unit/store/app.spec.ts b/tests/javascript/unit/store/app.spec.ts new file mode 100644 index 000000000..a083db3f0 --- /dev/null +++ b/tests/javascript/unit/store/app.spec.ts @@ -0,0 +1,26 @@ +import { AppInfoState, mutations } from '../../../../src/store/app' +import { APPLICATION_MUTATION_TYPES } from '../../../../src/types/MutationTypes' + +jest.mock('@nextcloud/router') + +describe('app.ts', () => { + 'use strict' + + // describe('actions', () => { + + // }) + + describe('mutations', () => { + it('SET_ERROR should update the error in the state', () => { + const state = { error: undefined } as AppInfoState + + const error = { message: 'test err' }; + + (mutations[APPLICATION_MUTATION_TYPES.SET_ERROR] as any)(state, error) + expect(state.error).toEqual(error); + + (mutations[APPLICATION_MUTATION_TYPES.SET_ERROR] as any)(state, undefined) + expect(state.error).toEqual(undefined) + }) + }) +}) |