浏览代码

NodeUtils tests

sanex3339 9 年之前
父节点
当前提交
4b9b9dde93
共有 1 个文件被更改,包括 30 次插入0 次删除
  1. 30 0
      test/NodeUtils.spec.ts

+ 30 - 0
test/NodeUtils.spec.ts

@@ -0,0 +1,30 @@
+import { NodeType } from "../src/enums/NodeType";
+
+import { NodeUtils } from '../src/NodeUtils';
+
+let assert: any = require('chai').assert;
+
+describe('NodeUtils', () => {
+    describe('addXVerbatimPropertyToLiterals (node: INode): void', () => {
+        let node: any;
+
+        beforeEach(() => {
+            node = {
+                type: NodeType.Literal,
+                value: 'string',
+                raw: `'string'`
+            };
+
+            NodeUtils.addXVerbatimPropertyToLiterals(node)
+        });
+
+        it('should add `x-verbatim-property` to `Literal` node', () => {
+            assert.deepEqual(node, {
+                type: NodeType.Literal,
+                value: 'string',
+                raw: `'string'`,
+                'x-verbatim-property': `'string'`
+            });
+        });
+    });
+});