1
0
Fork 0
mirror of synced 2024-07-04 22:11:23 +12:00

Adding test case for circular detection.

This commit is contained in:
mike12345567 2023-11-07 13:56:42 +00:00
parent 312415ca7d
commit 8d35453f01

View file

@ -188,4 +188,17 @@ describe("utils", () => {
expectResult(false)
})
})
describe("hasCircularStructure", () => {
it("should detect a circular structure", () => {
const a: any = { b: "b" }
const b = { a }
a.b = b
expect(utils.hasCircularStructure(b)).toBe(true)
})
it("should allow none circular structures", () => {
expect(utils.hasCircularStructure({ a: "b" })).toBe(false)
})
})
})