mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Fix console.errors
@mattwr18 @alina-beck there seems to be no switch or configuration to let vue-test-utils or jest fail whenever there is a call to `console.error`. The only way to test it for very specific tests is this. I took it from here: https://geedew.com/catching-prop-validation-in-vue-with-Jest/
This commit is contained in:
parent
701564c708
commit
9c98e30bb8
@ -22,11 +22,13 @@ describe('PostTeaser', () => {
|
||||
propsData = {
|
||||
post: {
|
||||
id: 'p23',
|
||||
disabled: false,
|
||||
shoutedCount: 0,
|
||||
commentsCount: 0,
|
||||
name: 'It is a post',
|
||||
author: {
|
||||
id: 'u1',
|
||||
},
|
||||
disabled: false,
|
||||
},
|
||||
}
|
||||
stubs = {
|
||||
@ -63,6 +65,13 @@ describe('PostTeaser', () => {
|
||||
})
|
||||
}
|
||||
|
||||
it('has no validation errors', () => {
|
||||
const spy = jest.spyOn(global.console, 'error');
|
||||
Wrapper()
|
||||
expect(spy).not.toBeCalled()
|
||||
spy.mockReset()
|
||||
})
|
||||
|
||||
beforeEach(jest.useFakeTimers)
|
||||
|
||||
describe('test Post callbacks', () => {
|
||||
@ -111,6 +120,7 @@ describe('PostTeaser', () => {
|
||||
describe('given a post', () => {
|
||||
beforeEach(() => {
|
||||
propsData.post = {
|
||||
...propsData.post,
|
||||
title: "It's a title",
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user