Skip to content

Commit c134692

Browse files
committed
Fix tests
1 parent 879782b commit c134692

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

test/nested.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ describe("Nested Database", () => {
414414
ref.set("a", new Map());
415415
ref.get("a").set("c", new Map());
416416
ref.get("a").set("b", 1);
417-
ref.get("c").set("d", 2);
418-
ref.get("c").set("e", 3);
417+
ref.get("a").get("c").set("d", 2);
418+
ref.get("a").get("c").set("e", 3);
419419

420420
expectNestedMapEqual(actual, ref);
421421
});

test/types.spec.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ describe("Types", () => {
3131
it("two types", () => {
3232
type Structure = { a: number, b: string };
3333
const map: TypedMap<Structure> = new Map();
34+
35+
map.set("a", 1);
3436
let valA: number | undefined = undefined;
3537
valA = map.get("a")
3638
expect(valA).to.equal(1)
@@ -51,14 +53,18 @@ describe("Types", () => {
5153

5254
describe("Nested object to map", () => {
5355
it("simple structure", () => {
54-
type Structure = { a: number, b: string };
55-
const map = new Map<"a" | "b", number | string>([["a", 1], ["b", "text"]]) as NestedObjectToMap<Structure>
56-
expect(map.keys()).to.deep.equal(["a", "b"])
57-
})
56+
type Structure = { a: number, b: string };
57+
const map = new Map<"a" | "b", number | string>([["a", 1], ["b", "text"]]) as NestedObjectToMap<Structure>
58+
59+
const a = map.get("a")
60+
expect(a).to.equal(1)
61+
})
5862
it("nested structure", () => {
5963
type Structure = { a: number, b: { c: string, d: boolean } };
64+
6065
const map = new Map<"a" | "b", number | Map<"c" | "d", string | boolean>>([["a", 1], ["b", new Map<"c" | "d", string | boolean>([["c", "text"], ["d", true]])]]) as NestedObjectToMap<Structure>
61-
expect(map.keys()).to.deep.equal(["a", "b"])
66+
const c = map.get("b")?.get("c")
67+
expect(c).to.equal("text")
6268
})
6369
it("error on wrong key", () => {
6470
type Structure = { a: number, b: string };

0 commit comments

Comments
 (0)