mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
test save categories
This commit is contained in:
parent
dcdef615c1
commit
3213bd3ee4
@ -15,8 +15,19 @@ describe('CategoriesFilter.vue', () => {
|
||||
'posts/filteredCategoryIds': jest.fn(() => []),
|
||||
}
|
||||
|
||||
const apolloMutationMock = jest.fn().mockResolvedValue({
|
||||
data: { saveCategorySettings: true },
|
||||
})
|
||||
|
||||
const mocks = {
|
||||
$t: jest.fn((string) => string),
|
||||
$apollo: {
|
||||
mutate: apolloMutationMock,
|
||||
},
|
||||
$toast: {
|
||||
success: jest.fn(),
|
||||
error: jest.fn(),
|
||||
},
|
||||
}
|
||||
|
||||
const Wrapper = () => {
|
||||
@ -76,5 +87,14 @@ describe('CategoriesFilter.vue', () => {
|
||||
expect(mutations['posts/RESET_CATEGORIES']).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('save categories', () => {
|
||||
it('calls the API', async () => {
|
||||
wrapper = await Wrapper()
|
||||
const saveButton = wrapper.findAll('.categories-filter .sidebar .base-button').at(1)
|
||||
saveButton.trigger('click')
|
||||
expect(apolloMutationMock).toBeCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user