Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
minor: better tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheraff committed Oct 8, 2023
1 parent ccd9925 commit 852d9c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions benchmark/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ const obj = {
set: new Set([1, 2, 3]),
xss: '</script><script>alert("XSS")</script>',
};

// circular references are not supported by tupleson
obj.self = obj;

const tson = createTson({
Expand Down
5 changes: 5 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ test("back-reference: circular object reference", () => {
const res = t.parse(str);

expect(res).toEqual(expected);
expect(res).toBe(res["a"]);
expect(res["b"]).toBe(res["a"]);
});

test("back-reference: circular array reference", () => {
Expand All @@ -67,6 +69,8 @@ test("back-reference: circular array reference", () => {
const res = t.parse(str);

expect(res).toEqual(expected);
expect(res).toBe(res[0]);
expect(res[1]).toBe(res[0]);
});

test("back-reference: non-circular complex reference", () => {
Expand All @@ -83,6 +87,7 @@ test("back-reference: non-circular complex reference", () => {
const str = t.stringify(expected);
const res = t.parse(str);

expect(res).toEqual(expected);
expect(res["b"]).toBe(res["a"]);
expect(res["d"]).toBe(res["c"]);
});
Expand Down

0 comments on commit 852d9c7

Please sign in to comment.