diff --git a/test/ValueObject.test.ts b/test/ValueObject.test.ts index 8af56d2d..67cf7cdf 100644 --- a/test/ValueObject.test.ts +++ b/test/ValueObject.test.ts @@ -1,4 +1,4 @@ -import { ValueObject } from '../src/tuplerone'; +import { ValueObject, shallow } from '../src/tuplerone'; describe(ValueObject.name, () => { it('constructs', () => { @@ -39,4 +39,13 @@ describe(ValueObject.name, () => { expect(() => ValueObject(null)).not.toThrow(); expect(() => ValueObject(undefined)).not.toThrow(); }); + + it('can be short-circuited if circular', () => { + const a: any = {}; + const b = { a }; + a.b = b; + expect(() => ValueObject(a)).toThrow(); + a[shallow] = true; + expect(() => ValueObject(a)).not.toThrow(); + }); });