-
Notifications
You must be signed in to change notification settings - Fork 273
/
extend-expect.d.ts
40 lines (37 loc) · 1.41 KB
/
extend-expect.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { StyleProp } from 'react-native';
import type { ReactTestInstance } from 'react-test-renderer';
import type { TextMatch, TextMatchOptions } from '../matches';
import type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
import type { Style } from './to-have-style';
export interface JestNativeMatchers<R> {
toBeOnTheScreen(): R;
toBeChecked(): R;
toBeCollapsed(): R;
toBeDisabled(): R;
toBeBusy(): R;
toBeEmptyElement(): R;
toBeEnabled(): R;
toBeExpanded(): R;
toBePartiallyChecked(): R;
toBeSelected(): R;
toBeVisible(): R;
toContainElement(element: ReactTestInstance | null): R;
toHaveAccessibilityValue(expectedValue: AccessibilityValueMatcher): R;
toHaveAccessibleName(expectedName?: TextMatch, options?: TextMatchOptions): R;
toHaveDisplayValue(expectedValue: TextMatch, options?: TextMatchOptions): R;
toHaveProp(name: string, expectedValue?: unknown): R;
toHaveStyle(style: StyleProp<Style>): R;
toHaveTextContent(expectedText: TextMatch, options?: TextMatchOptions): R;
}
// Implicit Jest global `expect`.
declare global {
namespace jest {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Matchers<R, T = {}> extends JestNativeMatchers<R> {}
}
}
// Explicit `@jest/globals` `expect` matchers.
declare module '@jest/expect' {
interface Matchers<R extends void | Promise<void>>
extends JestNativeMatchers<R> {}
}