diff --git a/benchmark/index.js b/benchmark/index.js index c64ea20a..2a5c4887 100644 --- a/benchmark/index.js +++ b/benchmark/index.js @@ -24,8 +24,6 @@ const obj = { set: new Set([1, 2, 3]), xss: '', }; - -// circular references are not supported by tupleson obj.self = obj; const tson = createTson({ diff --git a/src/index.test.ts b/src/index.test.ts index caebe3bd..5ca36fe2 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -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", () => { @@ -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", () => { @@ -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"]); });