瀏覽代碼

Added non-IfStatement test for isIfStatementNodeWithSingleStatementBody method

sanex 4 年之前
父節點
當前提交
49ec0a66b8
共有 1 個文件被更改,包括 16 次插入1 次删除
  1. 16 1
      test/unit-tests/node/node-guards/NodeGuards.spec.ts

+ 16 - 1
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),