From 33290eb0a30e9fc7e242d9e4b4adbbe7c2b5419d Mon Sep 17 00:00:00 2001 From: N00ts Date: Wed, 30 Jun 2021 18:12:02 +0200 Subject: [PATCH] updated to cover 100% branches --- tests/unit/helpers.spec.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/unit/helpers.spec.ts b/tests/unit/helpers.spec.ts index 2a48bf6..aa064ca 100644 --- a/tests/unit/helpers.spec.ts +++ b/tests/unit/helpers.spec.ts @@ -1,8 +1,18 @@ import { INode } from "../../src/structure/INode"; import { ensureState } from '../../src/misc/helpers'; -test("test", () => { +test("Expect to initialize state", () => { const n : INode = {}; ensureState(n); expect(n.state).toBeDefined(); -}); \ No newline at end of file +}); + +test("Expect not to initalize state", () => { + const n: INode = { + state: { + checked: true + } + } + ensureState(n); + expect(n.state).toMatchObject(n.state); +}) \ No newline at end of file