From 5437b784c6fbd7cc04945f04f9a1408421e6be6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Mon, 10 Sep 2018 22:32:57 +0100 Subject: [PATCH] fix(tests): add missing test coverage for console errors --- ui/src/index.test.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ui/src/index.test.js b/ui/src/index.test.js index 69a001431..f46d8fb1f 100644 --- a/ui/src/index.test.js +++ b/ui/src/index.test.js @@ -7,3 +7,35 @@ it("renders without crashing", () => { const Index = require("./index.js"); expect(Index).toBeTruthy(); }); + +describe("console", () => { + it("console.error() throws an error", () => { + expect(() => { + console.error("foo"); + }).toThrowError("message=foo args="); + }); + + it("console.warn() throws an error", () => { + expect(() => { + console.warn("foo", "bar"); + }).toThrowError("message=foo args=bar"); + }); + + it("console.info() throws an error", () => { + expect(() => { + console.warn("foo", "bar", "abc"); + }).toThrowError("message=foo args=bar,abc"); + }); + + it("console.log() throws an error", () => { + expect(() => { + console.warn("foo bar"); + }).toThrowError("message=foo bar args="); + }); + + it("console.trace() throws an error", () => { + expect(() => { + console.warn(); + }).toThrowError("message=undefined args="); + }); +});