UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

22 lines (20 loc) 889 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const testHelpers_1 = require("./../testHelpers"); describe("ArgumentedNode", () => { describe("getArguments", () => { function doTest(code, expectedArgs) { const { firstChild } = testHelpers_1.getInfoFromText(code); const args = firstChild.getDecorators()[0].getCallExpression().getArguments(); chai_1.expect(args.map(a => a.getText())).to.deep.equal(expectedArgs); } it("should get the arguments when there are none", () => { doTest("@decorator()\nclass MyClass {}", []); }); it("should get the arguments when they exist", () => { doTest("@decorator(arg1, arg2)\nclass MyClass {}", ["arg1", "arg2"]); }); }); }); //# sourceMappingURL=argumentedNodeTests.js.map