test(compiler-core): expect onError to be called (#976)

This commit is contained in:
扩散性百万甜面包 2020-04-17 20:58:38 +08:00 committed by GitHub
parent dd19db9c5d
commit 70c8c58be2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,11 +30,13 @@ describe('compiler: parse', () => {
}) })
test('simple text with invalid end tag', () => { test('simple text with invalid end tag', () => {
const onError = jest.fn()
const ast = baseParse('some text</div>', { const ast = baseParse('some text</div>', {
onError: () => {} onError
}) })
const text = ast.children[0] as TextNode const text = ast.children[0] as TextNode
expect(onError).toBeCalled()
expect(text).toStrictEqual({ expect(text).toStrictEqual({
type: NodeTypes.TEXT, type: NodeTypes.TEXT,
content: 'some text', content: 'some text',