diff --git a/src/compat/function/identity.spec.ts b/src/compat/function/identity.spec.ts new file mode 100644 index 000000000..375f2c654 --- /dev/null +++ b/src/compat/function/identity.spec.ts @@ -0,0 +1,27 @@ +import { describe, expect, it } from 'vitest'; +import { identity } from '../../function'; + +describe('identity', () => { + it('should return the input value unchanged for a number', () => { + expect(identity(5)).toBe(5); + }); + + it('should return the input value unchanged for a string', () => { + expect(identity('hello')).toBe('hello'); + }); + + it('should return the input value unchanged for an object', () => { + const obj = { key: 'value' }; + expect(identity(obj)).toBe(obj); + }); + + it('should return the input value unchanged for an array', () => { + const arr = [1, 2, 3]; + expect(identity(arr)).toBe(arr); + }); + + it('should return the input value unchanged for a boolean', () => { + expect(identity(true)).toBe(true); + expect(identity(false)).toBe(false); + }); +}); diff --git a/src/compat/function/noop.spec.ts b/src/compat/function/noop.spec.ts new file mode 100644 index 000000000..5e4b2d716 --- /dev/null +++ b/src/compat/function/noop.spec.ts @@ -0,0 +1,12 @@ +import { describe, expect, it } from 'vitest'; +import { noop } from '../../function'; + +describe('noop', () => { + it('should be a function', () => { + expect(typeof noop).toBe('function'); + }); + + it('should return undefined', () => { + expect(noop()).toBeUndefined(); + }); +});