summaryrefslogtreecommitdiffstats
path: root/tests/javascript/unit/store/app.spec.ts
blob: a083db3f079c3a2c055a278af60fbeb720d35a12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
		})
	})
})