ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
30 lines (28 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const ts = require("typescript");
const testHelpers_1 = require("./../testHelpers");
describe("Symbol", () => {
const { sourceFile: enumSourceFile } = testHelpers_1.getInfoFromText("enum MyEnum {}");
const enumDeclaration = enumSourceFile.getEnums()[0];
const enumNameNodeSymbol = enumDeclaration.getNameIdentifier().getSymbol();
describe("getName", () => {
it("should get the symbol name", () => {
chai_1.expect(enumNameNodeSymbol.getName()).to.equal("MyEnum");
});
});
describe("getDeclarations", () => {
it("should get the symbol declarations", () => {
const result = enumNameNodeSymbol.getDeclarations();
chai_1.expect(result.length).to.equal(1);
chai_1.expect(result[0]).to.equal(enumDeclaration);
});
});
describe("getFlags", () => {
it("should get the symbol flags", () => {
chai_1.expect(enumNameNodeSymbol.getFlags()).to.equal(ts.SymbolFlags.RegularEnum);
});
});
});
//# sourceMappingURL=symbolTests.js.map