ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
25 lines (23 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const compiler_1 = require("./../../../compiler");
const testHelpers_1 = require("./../testHelpers");
// todo: need to add tests here for getMembers
describe("VariableDeclarationList", () => {
describe("getDeclarationType", () => {
it("should get var for a var variable", () => {
const { firstChild } = testHelpers_1.getInfoFromText("var myVar;");
chai_1.expect(firstChild.getDeclarationList().getDeclarationType()).to.equal(compiler_1.VariableDeclarationType.Var);
});
it("should get let for a let variable", () => {
const { firstChild } = testHelpers_1.getInfoFromText("let myVar;");
chai_1.expect(firstChild.getDeclarationList().getDeclarationType()).to.equal(compiler_1.VariableDeclarationType.Let);
});
it("should get const for a const variable", () => {
const { firstChild } = testHelpers_1.getInfoFromText("const myVar = 3;");
chai_1.expect(firstChild.getDeclarationList().getDeclarationType()).to.equal(compiler_1.VariableDeclarationType.Const);
});
});
});
//# sourceMappingURL=variableDeclarationListTests.js.map