Files
languageservices/expressions/src/completion/descriptionDictionary.test.ts
T
Christopher Schleiden 2a3d63551f Rename folders
2023-02-22 15:52:40 -08:00

32 lines
1006 B
TypeScript

import {StringData} from "../data";
import {DescriptionDictionary} from "./descriptionDictionary";
describe("description dictionary", () => {
it("pairs contains all values", () => {
const d = new DescriptionDictionary();
d.add("ABC", new StringData("val"));
expect(d.pairs()).toEqual([{key: "ABC", value: new StringData("val")}]);
});
it("does not add duplicate entries", () => {
const d = new DescriptionDictionary();
d.add("ABC", new StringData("val1"));
d.add("ABC", new StringData("val2"));
d.add("abc", new StringData("val3"));
expect(d.pairs()).toEqual([{key: "ABC", value: new StringData("val1")}]);
});
it("can set optional descriptions", () => {
const d = new DescriptionDictionary();
d.add("ABC", new StringData("val"), "desc");
d.add("DEF", new StringData("val"));
expect(d.pairs()).toEqual([
{key: "ABC", value: new StringData("val"), description: "desc"},
{key: "DEF", value: new StringData("val")}
]);
});
});