test watchers

This commit is contained in:
Moriz Wahl 2022-01-14 13:39:34 +01:00
parent d88c16a66c
commit 0c6d63331f

View File

@ -230,6 +230,22 @@ describe('Creation', () => {
})
})
describe('watchers', () => {
beforeEach(() => {
jest.clearAllMocks()
})
it('calls API when criteria changes', async () => {
await wrapper.setData({ criteria: 'XX' })
expect(apolloQueryMock).toBeCalled()
})
it('calls API when currentPage changes', async () => {
await wrapper.setData({ currentPage: 2 })
expect(apolloQueryMock).toBeCalled()
})
})
describe('apollo returns error', () => {
beforeEach(() => {
apolloQueryMock.mockRejectedValue({