diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/datatype.spec.ts | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/test/datatype.spec.ts b/test/datatype.spec.ts index bee280d7..35ac512f 100644 --- a/test/datatype.spec.ts +++ b/test/datatype.spec.ts @@ -445,18 +445,27 @@ describe('datatype', () => { } }); - it('should not modify the input object', () => { - const min = 1; - const max = 2; - const opts = { - min: min, - max: max, + it('should not mutate the input object', () => { + const initalMin = 1; + const initalPrecision = 1; + const initalOtherProperty = 'hello darkness my old friend'; + const input: { + min?: number; + max?: number; + precision?: number; + otherProperty: string; + } = { + min: initalMin, + precision: initalPrecision, + otherProperty: initalOtherProperty, }; - faker.datatype.number(opts); + faker.datatype.number(input); - expect(opts.min).toBe(min); - expect(opts.max).toBe(max); + expect(input.min).toBe(initalMin); + expect(input.precision).toBe(initalPrecision); + expect(input.max).toBe(undefined); + expect(input.otherProperty).toBe(initalOtherProperty); }); }); |
