Adding test case for circular detection.
This commit is contained in:
parent
312415ca7d
commit
8d35453f01
|
@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue