reset warnHandler after testing thrown errors

This commit is contained in:
Moriz Wahl 2021-12-08 19:08:02 +01:00
parent d9f8387d7e
commit b063bdfab3

View File

@ -171,6 +171,7 @@ describe('Creation', () => {
describe('error', () => {
const consoleErrorMock = jest.fn()
const warnHandler = Vue.config.warnHandler
beforeEach(() => {
Vue.config.warnHandler = (w) => {}
@ -179,6 +180,10 @@ describe('Creation', () => {
wrapper.findComponent({ name: 'UserTable' }).vm.$emit('update-item', {}, 'no-rule')
})
afterEach(() => {
Vue.config.warnHandler = warnHandler
})
it('throws an error', () => {
expect(consoleErrorMock).toBeCalledWith(expect.objectContaining({ message: 'no-rule' }))
})