UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

31 lines (29 loc) 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const testHelpers_1 = require("./../testHelpers"); describe("StatementedNode", () => { describe("fill", () => { function doTest(startingCode, structure, expectedCode) { const { sourceFile } = testHelpers_1.getInfoFromText(startingCode); sourceFile.fill(structure); chai_1.expect(sourceFile.getText()).to.equal(expectedCode); } it("should not modify anything if the structure doesn't change anything", () => { doTest("", {}, ""); }); it("should modify when changed", () => { const structure = { classes: [{ name: "Identifier1" }], enums: [{ name: "Identifier2" }], functions: [{ name: "Identifier3" }], interfaces: [{ name: "Identifier4" }], namespaces: [{ name: "Identifier5" }], typeAliases: [{ name: "Identifier6", type: "string" }] }; doTest("", structure, "class Identifier1 {\n}\n\nenum Identifier2 {\n}\n\nfunction Identifier3() {\n}\n\ninterface Identifier4 {\n}\n\nnamespace Identifier5 {\n}\n\n" + "type Identifier6 = string;\n"); }); }); }); //# sourceMappingURL=statementedNodeTests.js.map