diff --git a/src/object/omit.spec.ts b/src/object/omit.spec.ts index abc69f3c7..80cf857b5 100644 --- a/src/object/omit.spec.ts +++ b/src/object/omit.spec.ts @@ -7,4 +7,23 @@ describe('omit', () => { expect(omit(object, ['foo', 'bar'])).toEqual({ baz: 3 }); }); + + it('should return an empty object if all keys are omitted', () => { + const obj = { a: 1, b: 2, c: 3 }; + const result = omit(obj, ['a', 'b', 'c']); + expect(result).toEqual({}); + }); + + it('should return the same object if no keys are omitted', () => { + const obj = { a: 1, b: 2, c: 3 }; + const result = omit(obj, []); + expect(result).toEqual({ a: 1, b: 2, c: 3 }); + }); + + it('should not affect the original object', () => { + const obj = { a: 1, b: 2, c: 3 }; + const result = omit(obj, ['b']); + expect(result).toEqual({ a: 1, c: 3 }); + expect(obj).toEqual({ a: 1, b: 2, c: 3 }); + }); });