Skip to content

dependabit / test-utils/src

test-utils/src

Main export for test utilities

Test Utilities

FunctionDescription
createMockApiResponseCreates a generic mock API response envelope for testing.
createMockArrayCreates an array of mock items using a factory function.
createMockEmailCreates generic mock email data for testing.
createMockErrorResponseCreates a generic mock error response envelope for testing.
createMockFnCreates a Vitest mock function.
createMockTimerActivates Vitest fake timers and returns a helper object.
createMockUserCreates generic mock user data for testing.
mockFetchReplaces the global fetch with a Vitest mock that returns response as JSON when url is requested.
spyOnCreates a Vitest spy on an object method.

Released under the MIT License.