mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
porper tests for the checkboxes
This commit is contained in:
parent
49f74ae3ab
commit
3c409c9bfd
@ -37,6 +37,7 @@ describe('UserCard_CoinAnimation', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks()
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ describe('UserCard_CoinAnimation', () => {
|
|||||||
|
|
||||||
describe('enable with success', () => {
|
describe('enable with success', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
mocks.$store.state.coinanimation = false
|
await wrapper.setData({ CoinAnimationStatus: false })
|
||||||
mockAPIcall.mockResolvedValue({
|
mockAPIcall.mockResolvedValue({
|
||||||
data: {
|
data: {
|
||||||
updateUserInfos: {
|
updateUserInfos: {
|
||||||
@ -58,7 +59,7 @@ describe('UserCard_CoinAnimation', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
await wrapper.find('input').trigger('change')
|
await wrapper.find('input').setChecked()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('calls the updateUserInfos mutation', () => {
|
it('calls the updateUserInfos mutation', () => {
|
||||||
@ -81,7 +82,7 @@ describe('UserCard_CoinAnimation', () => {
|
|||||||
|
|
||||||
describe('disable with success', () => {
|
describe('disable with success', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
mocks.$store.state.coinanimation = true
|
await wrapper.setData({ CoinAnimationStatus: true })
|
||||||
mockAPIcall.mockResolvedValue({
|
mockAPIcall.mockResolvedValue({
|
||||||
data: {
|
data: {
|
||||||
updateUserInfos: {
|
updateUserInfos: {
|
||||||
@ -89,7 +90,7 @@ describe('UserCard_CoinAnimation', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
wrapper.find('input').trigger('change')
|
await wrapper.find('input').setChecked(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('calls the subscribe mutation', () => {
|
it('calls the subscribe mutation', () => {
|
||||||
|
|||||||
@ -38,6 +38,7 @@ describe('UserCard_Newsletter', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks()
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -51,13 +52,13 @@ describe('UserCard_Newsletter', () => {
|
|||||||
|
|
||||||
describe('unsubscribe with success', () => {
|
describe('unsubscribe with success', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await wrapper.setData({ newsletterState: false })
|
await wrapper.setData({ newsletterState: true })
|
||||||
mockAPIcall.mockResolvedValue({
|
mockAPIcall.mockResolvedValue({
|
||||||
data: {
|
data: {
|
||||||
unsubscribeNewsletter: true,
|
unsubscribeNewsletter: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
await wrapper.find('input').trigger('change')
|
await wrapper.find('input').setChecked(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('calls the unsubscribe mutation', () => {
|
it('calls the unsubscribe mutation', () => {
|
||||||
@ -80,13 +81,13 @@ describe('UserCard_Newsletter', () => {
|
|||||||
|
|
||||||
describe('subscribe with success', () => {
|
describe('subscribe with success', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await wrapper.setData({ newsletterState: true })
|
await wrapper.setData({ newsletterState: false })
|
||||||
mockAPIcall.mockResolvedValue({
|
mockAPIcall.mockResolvedValue({
|
||||||
data: {
|
data: {
|
||||||
subscribeNewsletter: true,
|
subscribeNewsletter: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
wrapper.find('input').trigger('change')
|
await wrapper.find('input').setChecked()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('calls the subscribe mutation', () => {
|
it('calls the subscribe mutation', () => {
|
||||||
@ -104,7 +105,7 @@ describe('UserCard_Newsletter', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('toasts a success message', () => {
|
it('toasts a success message', () => {
|
||||||
expect(toastSuccessMock).toBeCalledWith('settings.newsletter.newsletterFalse')
|
expect(toastSuccessMock).toBeCalledWith('settings.newsletter.newsletterTrue')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user