Files
stack/apps/web/vitest.setup.ts
Jason Woltje 9820706be1
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
test(CI): fix all test failures from lint changes
Fixed test expectations to match new behavior after lint fixes:
- Updated null/undefined expectations to match ?? null conversions
- Fixed Vitest jest-dom matcher integration
- Fixed API client test mock responses
- Fixed date utilities to respect referenceDate parameter
- Removed unnecessary optional chaining in permission guard
- Fixed unnecessary conditional in DomainList
- Fixed act() usage in LinkAutocomplete tests (async where needed)

Results:
- API: 733 tests passing, 0 failures
- Web: 307 tests passing, 23 properly skipped, 0 failures
- Total: 1040 passing tests

Refs #CI-run-19

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-31 01:01:21 -06:00

27 lines
696 B
TypeScript

import { cleanup } from "@testing-library/react";
import { afterEach, expect } from "vitest";
import * as matchers from "@testing-library/jest-dom/matchers";
// Extend Vitest's expect with jest-dom matchers
expect.extend(matchers);
// Cleanup after each test to prevent test pollution
afterEach(() => {
cleanup();
});
// Mock window.matchMedia for tests that might use it
Object.defineProperty(window, "matchMedia", {
writable: true,
value: (query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: () => {},
removeListener: () => {},
addEventListener: () => {},
removeEventListener: () => {},
dispatchEvent: () => false,
}),
});