From 7d93cef43d768d2a68614b943dca70681b4ad211 Mon Sep 17 00:00:00 2001 From: Kabir Shah Date: Thu, 4 Apr 2019 01:06:34 -0700 Subject: [PATCH] update tests for parse errors --- packages/moon/test/compiler/parser.test.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/moon/test/compiler/parser.test.js b/packages/moon/test/compiler/parser.test.js index b68a767d..dd543610 100644 --- a/packages/moon/test/compiler/parser.test.js +++ b/packages/moon/test/compiler/parser.test.js @@ -89,14 +89,20 @@ test("parse nested elements", () => { }); test("parse error from invalid view", () => { + console.error = jest.fn(); + expect(parseTest(`

text?

- `)).toBe(null); + `).constructor.name).toBe("ParseError"); + expect(console.error).toBeCalled(); }); test("parse error from empty element", () => { - expect(parseTest("")).toBe(null); + console.error = jest.fn(); + + expect(parseTest("").constructor.name).toBe("ParseError"); + expect(console.error).toBeCalled(); });