mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
add test for object as key use case
This commit is contained in:
@@ -15,4 +15,17 @@ describe("TupleKey", () => {
|
|||||||
|
|
||||||
expect(`${tupleKey}`).toEqual("150|539");
|
expect(`${tupleKey}`).toEqual("150|539");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("supports usage as key in object", () => {
|
||||||
|
const tupleKey1 = new TupleKey("1", "2");
|
||||||
|
const tupleKey2 = new TupleKey("3", "4");
|
||||||
|
|
||||||
|
const sampleObject = {
|
||||||
|
[tupleKey1.toString()]: "value1",
|
||||||
|
[tupleKey2.toString()]: "value2",
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(sampleObject[tupleKey1.toString()]).toEqual("value1");
|
||||||
|
expect(sampleObject[(new TupleKey("1", "2")).toString()]).toEqual("value1");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user