mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
add TupleKey method to convert string key back to tuple
This commit is contained in:
@@ -28,4 +28,18 @@ describe("TupleKey", () => {
|
||||
expect(sampleObject[tupleKey1.toString()]).toEqual("value1");
|
||||
expect(sampleObject[(new TupleKey("1", "2")).toString()]).toEqual("value1");
|
||||
});
|
||||
});
|
||||
|
||||
describe("fromExistingStringKey", () => {
|
||||
it("creates a new TupleKey from an existing string key", () => {
|
||||
const strKey = "hello|there";
|
||||
const tupleKey = TupleKey.fromExistingStringKey(strKey);
|
||||
expect(tupleKey.toString()).toEqual(strKey);
|
||||
});
|
||||
|
||||
it("creates an empty tuple if there is no string", () => {
|
||||
const strKey = "";
|
||||
const tupleKey = TupleKey.fromExistingStringKey(strKey);
|
||||
expect(tupleKey.toString()).toEqual(strKey);
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user