Skip to content

Commit f08190f

Browse files
committed
fix: asdf
1 parent f748061 commit f08190f

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

jest-setup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import '@testing-library/jest-dom';
33

44
// Mock ResizeObserver for tests
5-
(global as any).ResizeObserver = jest.fn().mockImplementation(() => ({
5+
declare const global: any;
6+
global.ResizeObserver = jest.fn().mockImplementation(() => ({
67
observe: jest.fn(),
78
unobserve: jest.fn(),
89
disconnect: jest.fn(),

src/hooks/useParallaxController.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Wrapper = (props: PropsWithChildren<{}>) => (
1111
);
1212

1313
describe('given useParallaxController hook', () => {
14-
const { window } = global as any;
14+
const { window } = (global as any);
1515
afterEach(() => {
1616
(global as any).window = window;
1717
});

src/types/global.d.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,30 @@ declare global {
66
// Import jest-dom types
77
import '@testing-library/jest-dom';
88

9-
// Extend Jest matchers
10-
declare module '@jest/expect' {
11-
interface Matchers<R> {
12-
toBeInTheDocument(): R;
13-
toHaveAttribute(attr: string, value?: string): R;
14-
toHaveClass(className: string): R;
15-
toHaveStyle(css: string | Record<string, any>): R;
9+
// Extend Jest matchers for all expect types
10+
declare global {
11+
namespace jest {
12+
interface Matchers<R> {
13+
toBeInTheDocument(): R;
14+
toHaveAttribute(attr: string, value?: string): R;
15+
toHaveClass(className: string): R;
16+
toHaveStyle(css: string | Record<string, any>): R;
17+
toHaveTextContent(text: string | RegExp): R;
18+
toBeVisible(): R;
19+
toBeDisabled(): R;
20+
toBeEnabled(): R;
21+
toBeRequired(): R;
22+
toBeValid(): R;
23+
toBeInvalid(): R;
24+
toHaveValue(value: string | string[] | number): R;
25+
toHaveDisplayValue(value: string | RegExp | (string | RegExp)[]): R;
26+
toBeChecked(): R;
27+
toBePartiallyChecked(): R;
28+
toHaveDescription(text?: string | RegExp): R;
29+
toHaveAccessibleDescription(text?: string | RegExp): R;
30+
toHaveAccessibleName(text?: string | RegExp): R;
31+
toHaveFormValues(expectedValues: Record<string, any>): R;
32+
toHaveFocus(): R;
33+
}
1634
}
1735
}

0 commit comments

Comments
 (0)