diff --git a/src/matchers/__tests__/to-have-text-content.test.tsx b/src/matchers/__tests__/to-have-text-content.test.tsx index 71e7b628b..5115a7ca5 100644 --- a/src/matchers/__tests__/to-have-text-content.test.tsx +++ b/src/matchers/__tests__/to-have-text-content.test.tsx @@ -1,5 +1,3 @@ -/// - import * as React from 'react'; import { View, Text } from 'react-native'; import { render, screen } from '../..'; diff --git a/src/matchers/extend-expect.ts b/src/matchers/extend-expect.ts index e0a1dc2a3..ec19feb5d 100644 --- a/src/matchers/extend-expect.ts +++ b/src/matchers/extend-expect.ts @@ -1,5 +1,3 @@ -/// - import { toBeOnTheScreen } from './to-be-on-the-screen'; import { toBeChecked } from './to-be-checked'; import { toBeCollapsed } from './to-be-collapsed'; @@ -18,6 +16,8 @@ import { toHaveProp } from './to-have-prop'; import { toHaveStyle } from './to-have-style'; import { toHaveTextContent } from './to-have-text-content'; +export type * from './types'; + expect.extend({ toBeOnTheScreen, toBeChecked, diff --git a/src/matchers/extend-expect.d.ts b/src/matchers/types.ts similarity index 76% rename from src/matchers/extend-expect.d.ts rename to src/matchers/types.ts index d83358924..78a85b886 100644 --- a/src/matchers/extend-expect.d.ts +++ b/src/matchers/types.ts @@ -1,8 +1,15 @@ import type { StyleProp } from 'react-native'; import type { ReactTestInstance } from 'react-test-renderer'; +import { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value'; +import { TextMatch, TextMatchOptions } from '../matches'; +import { Style } from './to-have-style'; export interface JestNativeMatchers { + /** + * Assert whether an element is present in the element tree or not. + */ toBeOnTheScreen(): R; + toBeChecked(): R; toBeCollapsed(): R; toBeDisabled(): R; @@ -31,26 +38,8 @@ declare global { } // Explicit `@jest/globals` `expect` matchers. +// @ts-ignore declare module '@jest/expect' { interface Matchers> extends JestNativeMatchers {} } - -// Used types - -export type Style = ViewStyle | TextStyle | ImageStyle; - -export interface AccessibilityValueMatcher { - min?: number; - max?: number; - now?: number; - text?: TextMatch; -} - -export type TextMatch = string | RegExp; -export type TextMatchOptions = { - exact?: boolean; - normalizer?: NormalizerFn; -}; - -export type NormalizerFn = (textToNormalize: string) => string;