From 49ec0a66b8ad4e8747da8dd9e5ba64fabfad1fa1 Mon Sep 17 00:00:00 2001 From: sanex Date: Sun, 17 Jan 2021 21:49:01 +0300 Subject: [PATCH] Added non-IfStatement test for isIfStatementNodeWithSingleStatementBody method --- .../node/node-guards/NodeGuards.spec.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/unit-tests/node/node-guards/NodeGuards.spec.ts b/test/unit-tests/node/node-guards/NodeGuards.spec.ts index 25132fea..ed5bd375 100644 --- a/test/unit-tests/node/node-guards/NodeGuards.spec.ts +++ b/test/unit-tests/node/node-guards/NodeGuards.spec.ts @@ -79,7 +79,22 @@ describe('NodeGuards', () => { }); describe('false checks', () => { - describe('Variant #1: multiple statements `consequent` and `alternate`', () => { + describe('Variant #1: other node', () => { + const expectedResult: boolean = false; + const node: ESTree.Literal = NodeFactory.literalNode(true); + + let result: boolean; + + before(() => { + result = NodeGuards.isIfStatementNodeWithSingleStatementBody(node); + }); + + it('should return `false` for other node', () => { + assert.equal(result, expectedResult); + }); + }); + + describe('Variant #2: multiple statements `consequent` and `alternate`', () => { const expectedResult: boolean = false; const node: ESTree.IfStatement = NodeFactory.ifStatementNode( NodeFactory.literalNode(true),