diff --git a/packages/fast-check/test/unit/arbitrary/_internals/ConstantArbitrary.spec.ts b/packages/fast-check/test/unit/arbitrary/_internals/ConstantArbitrary.spec.ts index 76ece521a53..e02ed91cfcd 100644 --- a/packages/fast-check/test/unit/arbitrary/_internals/ConstantArbitrary.spec.ts +++ b/packages/fast-check/test/unit/arbitrary/_internals/ConstantArbitrary.spec.ts @@ -140,6 +140,34 @@ describe('ConstantArbitrary', () => { // Assert expect(out).toBe(false); // Object.is([], []) is falsy }); + + it.each([{ source: -0 }, { source: 0 }, { source: 48 }])( + 'should not accept to shrink -$source if built with $source', + ({ source }) => { + // Arrange + const arb = new ConstantArbitrary([source]); + + // Act + const out = arb.canShrinkWithoutContext(-source); + + // Assert + expect(out).toBe(false); + }, + ); + + it.each([{ source: -0 }, { source: 0 }, { source: 48 }])( + 'should accept to shrink $source if built with $source', + ({ source }) => { + // Arrange + const arb = new ConstantArbitrary([source]); + + // Act + const out = arb.canShrinkWithoutContext(source); + + // Assert + expect(out).toBe(true); + }, + ); }); describe('shrink', () => {