Explorar el Código

NodeUtils tests refactoring

sanex3339 hace 9 años
padre
commit
45e7695a14
Se han modificado 3 ficheros con 5 adiciones y 5 borrados
  1. 2 2
      dist/index.js
  2. 2 2
      src/NodeUtils.ts
  3. 1 1
      test/NodeUtils.spec.ts

+ 2 - 2
dist/index.js

@@ -249,11 +249,11 @@ module.exports =
 	
 	            if (Nodes_1.Nodes.isNodeHasBlockStatement(node)) {
 	                if (node.body[index] === undefined) {
-	                    throw new ReferenceError("Wrong index `" + index + "`. BlockStatement body length is `" + node.body.length + "`.");
+	                    throw new ReferenceError("Wrong index `" + index + "`. Block-statement body length is `" + node.body.length + "`");
 	                }
 	                return node.body[index];
 	            }
-	            throw new TypeError('The specified node has not block statement');
+	            throw new TypeError('The specified node have no a block-statement');
 	        }
 	    }, {
 	        key: "getBlockScopeOfNode",

+ 2 - 2
src/NodeUtils.ts

@@ -53,13 +53,13 @@ export class NodeUtils {
     public static getBlockStatementNodeByIndex (node: INode, index: number = 0): INode {
         if (Nodes.isNodeHasBlockStatement(node)) {
             if (node.body[index] === undefined) {
-                throw new ReferenceError(`Wrong index \`${index}\`. BlockStatement body length is \`${node.body.length}\`.`);
+                throw new ReferenceError(`Wrong index \`${index}\`. Block-statement body length is \`${node.body.length}\``);
             }
 
             return node.body[index];
         }
 
-        throw new TypeError('The specified node has not block statement');
+        throw new TypeError('The specified node have no a block-statement');
     }
 
     /**

+ 1 - 1
test/NodeUtils.spec.ts

@@ -122,7 +122,7 @@ describe('NodeUtils', () => {
             }, ReferenceError);
         });
 
-        it('should throw a `TypeError` if node has not block-statement', () => {
+        it('should throw a `TypeError` if node have no a block-statement', () => {
             assert.throws(function () {
                 NodeUtils.getBlockStatementNodeByIndex(identifierNode, 1)
             }, TypeError);