UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

24 lines (22 loc) 976 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const testHelpers_1 = require("./../compiler/testHelpers"); describe("tests for issue #76", () => { it("should rename the class when there's a comment block above", () => { const text = `/** * Test */ class Identifier { /** Other text */ prop: string; }`; const { firstChild } = testHelpers_1.getInfoFromText(text); firstChild.rename("NewName"); firstChild.getInstanceProperties()[0].rename("newPropName"); chai_1.expect(firstChild.getFullText()).to.equal(text.replace("Identifier", "NewName").replace("prop", "newPropName")); chai_1.expect(firstChild.getNameIdentifier().compilerNode.escapedText).to.equal("NewName"); chai_1.expect(firstChild.getInstanceProperties()[0].getNameIdentifier().compilerNode.escapedText).to.equal("newPropName"); }); }); //# sourceMappingURL=76tests.js.map