mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Tests that the hasElopage flag is changed.
This commit is contained in:
parent
fb93b39a19
commit
f7d696eaca
@ -12,6 +12,7 @@ const {
|
||||
newsletterState,
|
||||
publisherId,
|
||||
community,
|
||||
hasElopage,
|
||||
} = mutations
|
||||
const { login, logout } = actions
|
||||
|
||||
@ -114,6 +115,14 @@ describe('Vuex store', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('hasElopage', () => {
|
||||
it('sets the state of hasElopage', () => {
|
||||
const state = { hasElopage: false }
|
||||
hasElopage(state, true)
|
||||
expect(state.hasElopage).toBeTruthy()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('actions', () => {
|
||||
@ -131,11 +140,12 @@ describe('Vuex store', () => {
|
||||
klickTipp: {
|
||||
newsletterState: true,
|
||||
},
|
||||
hasElopage: false,
|
||||
}
|
||||
|
||||
it('calls eight commits', () => {
|
||||
it('calls nine commits', () => {
|
||||
login({ commit, state }, commitedData)
|
||||
expect(commit).toHaveBeenCalledTimes(8)
|
||||
expect(commit).toHaveBeenCalledTimes(9)
|
||||
})
|
||||
|
||||
it('commits email', () => {
|
||||
@ -177,15 +187,20 @@ describe('Vuex store', () => {
|
||||
login({ commit, state }, commitedData)
|
||||
expect(commit).toHaveBeenNthCalledWith(8, 'newsletterState', true)
|
||||
})
|
||||
|
||||
it('commits hasElopage', () => {
|
||||
login({ commit, state }, commitedData)
|
||||
expect(commit).toHaveBeenNthCalledWith(9, 'hasElopage', false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('logout', () => {
|
||||
const commit = jest.fn()
|
||||
const state = {}
|
||||
|
||||
it('calls eight commits', () => {
|
||||
it('calls nine commits', () => {
|
||||
logout({ commit, state })
|
||||
expect(commit).toHaveBeenCalledTimes(8)
|
||||
expect(commit).toHaveBeenCalledTimes(9)
|
||||
})
|
||||
|
||||
it('commits token', () => {
|
||||
@ -228,6 +243,11 @@ describe('Vuex store', () => {
|
||||
expect(commit).toHaveBeenNthCalledWith(8, 'newsletterState', null)
|
||||
})
|
||||
|
||||
it('commits hasElopage', () => {
|
||||
logout({ commit, state })
|
||||
expect(commit).toHaveBeenNthCalledWith(9, 'hasElopage', false)
|
||||
})
|
||||
|
||||
// how to get this working?
|
||||
it.skip('calls localStorage.clear()', () => {
|
||||
const clearStorageMock = jest.fn()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user