import { isPromise } from '../is-promise'; describe('isPromise', () => { test('should return true for a Promise', () => { const promise = new Promise((resolve) => resolve('success')); expect(isPromise(promise)).toBe(true); }); test('should return true for an object with a "then" function', () => { const fakePromise = { then: jest.fn() }; expect(isPromise(fakePromise)).toBe(true); }); test('should return false for a regular object', () => { const obj = {}; expect(isPromise(obj)).toBe(false); }); test('should return false for a function', () => { const func = () => {}; expect(isPromise(func)).toBe(false); }); test('should return false for null', () => { expect(isPromise(null)).toBe(false); }); test('should return false for undefined', () => { expect(isPromise(undefined)).toBe(false); }); test('should return false for a primitive type (string)', () => { expect(isPromise('string')).toBe(false); }); test('should return false for a primitive type (number)', () => { expect(isPromise(42)).toBe(false); }); test('should return false for a primitive type (boolean)', () => { expect(isPromise(true)).toBe(false); expect(isPromise(false)).toBe(false); }); });