- Install Jest for unit testing with React Testing Library - Install Playwright for end-to-end testing - Configure Jest with proper TypeScript support and module mapping - Create test setup files and utilities for both unit and e2e tests Components: * Jest configuration with coverage thresholds * Playwright configuration with browser automation * Unit tests for LoginForm, AuthContext, and useSocketIO hook * E2E tests for authentication, dashboard, and agents workflows * GitHub Actions workflow for automated testing * Mock data and API utilities for consistent testing * Test documentation with best practices Testing features: - Unit tests with 70% coverage threshold - E2E tests with API mocking and user journey testing - CI/CD integration for automated test runs - Cross-browser testing support with Playwright - Authentication system testing end-to-end 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
43 lines
1.8 KiB
TypeScript
43 lines
1.8 KiB
TypeScript
import { AsymmetricMatchers, AsymmetricMatchers as AsymmetricMatchers$1, BaseExpect, MatcherContext, MatcherFunction, MatcherFunctionWithContext, MatcherState, MatcherUtils, Matchers, Matchers as Matchers$1 } from "expect";
|
|
import { SnapshotMatchers, SnapshotState, addSerializer } from "jest-snapshot";
|
|
|
|
//#region src/types.d.ts
|
|
|
|
type JestExpect = {
|
|
<T = unknown>(actual: T): JestMatchers<void, T> & Inverse<JestMatchers<void, T>> & PromiseMatchers<T>;
|
|
addSnapshotSerializer: typeof addSerializer;
|
|
} & BaseExpect & AsymmetricMatchers$1 & Inverse<Omit<AsymmetricMatchers$1, 'any' | 'anything'>>;
|
|
type Inverse<Matchers> = {
|
|
/**
|
|
* Inverse next matcher. If you know how to test something, `.not` lets you test its opposite.
|
|
*/
|
|
not: Matchers$1;
|
|
};
|
|
type JestMatchers<R extends void | Promise<void>, T> = Matchers$1<R, T> & SnapshotMatchers<R, T>;
|
|
type PromiseMatchers<T = unknown> = {
|
|
/**
|
|
* Unwraps the reason of a rejected promise so any other matcher can be chained.
|
|
* If the promise is fulfilled the assertion fails.
|
|
*/
|
|
rejects: JestMatchers<Promise<void>, T> & Inverse<JestMatchers<Promise<void>, T>>;
|
|
/**
|
|
* Unwraps the value of a fulfilled promise so any other matcher can be chained.
|
|
* If the promise is rejected the assertion fails.
|
|
*/
|
|
resolves: JestMatchers<Promise<void>, T> & Inverse<JestMatchers<Promise<void>, T>>;
|
|
};
|
|
declare module 'expect' {
|
|
interface MatcherState {
|
|
snapshotState: SnapshotState;
|
|
/** Whether the test was called with `test.failing()` */
|
|
testFailing?: boolean;
|
|
}
|
|
interface BaseExpect {
|
|
addSnapshotSerializer: typeof addSerializer;
|
|
}
|
|
}
|
|
//#endregion
|
|
//#region src/index.d.ts
|
|
declare const jestExpect: JestExpect;
|
|
//#endregion
|
|
export { AsymmetricMatchers, JestExpect, MatcherContext, MatcherFunction, MatcherFunctionWithContext, MatcherState, MatcherUtils, Matchers, jestExpect }; |