diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 614b97277..b9330e4b5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,20 +44,6 @@ jobs: - name: Typecheck run: yarn typecheck - flow: - needs: [install-cache-deps] - runs-on: ubuntu-latest - name: Flow - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node.js and deps - uses: ./.github/actions/setup-deps - - - name: Flow - run: yarn flow - test: needs: [install-cache-deps] runs-on: ubuntu-latest diff --git a/README.md b/README.md index ff6292d31..3d3670a81 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,8 @@ test('form submits two answers', async () => { await user.press(screen.getByRole('button', { name: 'Submit' })); expect(onSubmit).toHaveBeenCalledWith({ - '1': { q: 'q1', a: 'a1' }, - '2': { q: 'q2', a: 'a2' }, + 1: { q: 'q1', a: 'a1' }, + 2: { q: 'q2', a: 'a2' }, }); }); ``` @@ -143,7 +143,6 @@ The [public API](https://callstack.github.io/react-native-testing-library/docs/a Check out our list of [Community Resources about RNTL](https://callstack.github.io/react-native-testing-library/docs/community-resources). - ## Made with ❤️ at Callstack React Native Testing Library is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Callstack](https://callstack.com) is a group of React and React Native geeks, contact us at [hello@callstack.com](mailto:hello@callstack.com) if you need any help with these or just want to say hi! diff --git a/examples/basic/components/LoginForm.tsx b/examples/basic/components/LoginForm.tsx index 57567ecf6..5429eb936 100644 --- a/examples/basic/components/LoginForm.tsx +++ b/examples/basic/components/LoginForm.tsx @@ -82,7 +82,7 @@ async function authUser(username: string, password: string): Promise { const hasValidCredentials = username === 'admin' && password === 'admin1'; resolve(hasValidCredentials ? username : null); - }, 250) + }, 250), ); } diff --git a/examples/redux/components/AddTodo.test.js b/examples/redux/components/AddTodo.test.js index 6da7ae751..c95dddcba 100644 --- a/examples/redux/components/AddTodo.test.js +++ b/examples/redux/components/AddTodo.test.js @@ -22,6 +22,6 @@ test('adds a new todo to redux store when submitting form', () => { text: textToEnter, date: expect.any(Date), }), - ]) + ]), ); }); diff --git a/package.json b/package.json index b73040b1a..ea792f695 100644 --- a/package.json +++ b/package.json @@ -69,35 +69,33 @@ } }, "devDependencies": { - "@babel/cli": "^7.23.4", - "@babel/core": "^7.23.3", + "@babel/cli": "^7.23.9", + "@babel/core": "^7.24.0", "@babel/plugin-transform-flow-strip-types": "^7.23.3", - "@babel/preset-env": "^7.23.3", - "@babel/preset-flow": "^7.23.3", + "@babel/preset-env": "^7.24.0", + "@babel/preset-flow": "^7.24.0", "@babel/preset-react": "^7.23.3", "@babel/preset-typescript": "^7.23.3", "@callstack/eslint-config": "^14.1.0", "@release-it/conventional-changelog": "^8.0.1", "@relmify/jest-serializer-strip-ansi": "^1.0.2", - "@types/jest": "^29.5.10", - "@types/react": "^18.2.38", + "@types/jest": "^29.5.12", + "@types/react": "^18.2.65", "@types/react-test-renderer": "^18.0.7", "babel-jest": "^29.7.0", - "dedent": "^1.5.1", "del-cli": "^5.1.0", - "eslint": "^8.54.0", + "eslint": "^8.57.0", "eslint-plugin-flowtype": "^8.0.3", - "eslint-plugin-prettier": "^5.1.2", + "eslint-plugin-prettier": "^4.2.1", "flow-bin": "~0.170.0", - "flow-copy-source": "^2.0.9", "jest": "^29.7.0", - "prettier": "^3.1.1", + "prettier": "^2.8.8", "react": "18.2.0", - "react-native": "0.72.7", + "react-native": "0.73.6", "react-test-renderer": "18.2.0", - "release-it": "^17.0.1", + "release-it": "^17.1.1", "strip-ansi": "^6.0.1", - "typescript": "^5.3.2" + "typescript": "^5.4.2" }, "publishConfig": { "registry": "https://registry.npmjs.org" diff --git a/.prettierrc.js b/prettier.config.js similarity index 82% rename from .prettierrc.js rename to prettier.config.js index 14f748e9f..9c95a9f6a 100644 --- a/.prettierrc.js +++ b/prettier.config.js @@ -1,5 +1,5 @@ // added for Jest inline snapshots to not use default Prettier config module.exports = { singleQuote: true, - trailingComma: 'es5', + trailingComma: 'all', }; diff --git a/src/__tests__/fire-event-textInput.test.tsx b/src/__tests__/fire-event-textInput.test.tsx index d7bd823a7..67b42d9d3 100644 --- a/src/__tests__/fire-event-textInput.test.tsx +++ b/src/__tests__/fire-event-textInput.test.tsx @@ -26,7 +26,7 @@ test('should fire only non-touch-related events on non-editable TextInput', () = onChangeText={onChangeText} onSubmitEditing={onSubmitEditing} onLayout={onLayout} - /> + />, ); const subject = screen.getByTestId('subject'); @@ -57,7 +57,7 @@ test('should fire only non-touch-related events on non-editable TextInput with n onLayout={onLayout} > Nested Text - + , ); const subject = screen.getByText('Nested Text'); @@ -106,7 +106,7 @@ test('should fire only non-touch-related events on non-editable wrapped TextInpu onChangeText={onChangeText} onSubmitEditing={onSubmitEditing} onLayout={onLayout} - /> + />, ); const subject = screen.getByTestId('subject'); @@ -138,7 +138,7 @@ test('should fire only non-touch-related events on non-editable double wrapped T onChangeText={onChangeText} onSubmitEditing={onSubmitEditing} onLayout={onLayout} - /> + />, ); const subject = screen.getByTestId('subject'); diff --git a/src/__tests__/fire-event.test.tsx b/src/__tests__/fire-event.test.tsx index fc0f6aa28..c0ac2a9f6 100644 --- a/src/__tests__/fire-event.test.tsx +++ b/src/__tests__/fire-event.test.tsx @@ -78,7 +78,7 @@ describe('fireEvent', () => { const onPressMock = jest.fn(); render( // TODO: this functionality is buggy, i.e. it will fail if we wrap this component with a View. - + , ); fireEvent(screen.getByText('Without event'), 'press'); expect(onPressMock).not.toHaveBeenCalled(); @@ -91,7 +91,7 @@ describe('fireEvent', () => { render( - + , ); fireEvent(screen.getByText('Custom event component'), 'customEvent', EVENT_DATA); @@ -129,7 +129,7 @@ test('fireEvent.scroll', () => { render( XD - + , ); fireEvent.scroll(screen.getByText('XD'), eventData); @@ -144,7 +144,7 @@ test('fireEvent.changeText', () => { render( - + , ); fireEvent.changeText(screen.getByPlaceholderText('Customer placeholder'), CHANGE_TEXT); @@ -179,7 +179,7 @@ test('should not fire on disabled TouchableOpacity', () => { Trigger - + , ); fireEvent.press(screen.getByText('Trigger')); @@ -193,7 +193,7 @@ test('should not fire on disabled Pressable', () => { Trigger - + , ); fireEvent.press(screen.getByText('Trigger')); @@ -207,7 +207,7 @@ test('should not fire inside View with pointerEvents="none"', () => { Trigger - + , ); fireEvent.press(screen.getByText('Trigger')); @@ -222,7 +222,7 @@ test('should not fire inside View with pointerEvents="box-only"', () => { Trigger - + , ); fireEvent.press(screen.getByText('Trigger')); @@ -237,7 +237,7 @@ test('should fire inside View with pointerEvents="box-none"', () => { Trigger - + , ); fireEvent.press(screen.getByText('Trigger')); @@ -252,7 +252,7 @@ test('should fire inside View with pointerEvents="auto"', () => { Trigger - + , ); fireEvent.press(screen.getByText('Trigger')); @@ -269,7 +269,7 @@ test('should not fire deeply inside View with pointerEvents="box-only"', () => { Trigger - + , ); fireEvent.press(screen.getByText('Trigger')); @@ -311,7 +311,7 @@ test('should pass event up on disabled TouchableOpacity', () => { Inner Trigger - + , ); fireEvent.press(screen.getByText('Inner Trigger')); @@ -327,7 +327,7 @@ test('should pass event up on disabled Pressable', () => { Inner Trigger - + , ); fireEvent.press(screen.getByText('Inner Trigger')); @@ -376,7 +376,7 @@ test('is not fooled by non-responder wrapping host elements', () => { render( - + , ); fireEvent.press(screen.getByText('Trigger')); diff --git a/src/__tests__/host-component-names.test.tsx b/src/__tests__/host-component-names.test.tsx index f0c004b29..ca526742d 100644 --- a/src/__tests__/host-component-names.test.tsx +++ b/src/__tests__/host-component-names.test.tsx @@ -53,7 +53,7 @@ describe('getHostComponentNames', () => { expect(() => act(() => { getHostComponentNames(); - }) + }), ).not.toThrow(); }); }); diff --git a/src/__tests__/host-text-nesting.test.tsx b/src/__tests__/host-text-nesting.test.tsx index f9a4c1c9d..e358d2a21 100644 --- a/src/__tests__/host-text-nesting.test.tsx +++ b/src/__tests__/host-text-nesting.test.tsx @@ -28,7 +28,7 @@ describe('nested text handling', () => { About - + , ); expect(screen.getByRole('header', { name: 'About' }).props.testID).toBe('child'); @@ -40,7 +40,7 @@ describe('nested text handling', () => { Save - + , ); expect(screen.getByRole('button', { name: 'Save' }).props.testID).toBe('pressable'); @@ -54,7 +54,7 @@ describe('nested text handling', () => { Save - + , ); expect(screen.getByRole('button', { name: 'Save' }).props.testID).toBe('pressable'); @@ -64,7 +64,7 @@ describe('nested text handling', () => { render( Save - + , ); expect(screen.getByText('Save').props.testID).toBe('text'); @@ -76,7 +76,7 @@ describe('nested text handling', () => { Save - + , ); expect(screen.getByText('Save').props.testID).toBe('text'); diff --git a/src/__tests__/react-native-api.test.tsx b/src/__tests__/react-native-api.test.tsx index ab1bfcb7d..7393fd4b1 100644 --- a/src/__tests__/react-native-api.test.tsx +++ b/src/__tests__/react-native-api.test.tsx @@ -37,7 +37,7 @@ test('React Native API assumption: nested renders single host element', ( Deeply nested - + , ); expect(screen.toJSON()).toMatchInlineSnapshot(` @@ -70,7 +70,7 @@ test('React Native API assumption: renders single host element', () defaultValue="default" value="currentValue" placeholder="Placeholder" - /> + />, ); expect(screen.toJSON()).toMatchInlineSnapshot(` @@ -87,7 +87,7 @@ test('React Native API assumption: with nested Text renders single h render( Hello - + , ); expect(screen.toJSON()).toMatchInlineSnapshot(` @@ -144,7 +144,7 @@ test('React Native API assumption: aria-* props render on host View', () => { aria-valuemin={0} aria-valuenow={5} aria-valuetext="ValueText" - /> + />, ); expect(screen.toJSON()).toMatchInlineSnapshot(` @@ -192,7 +192,7 @@ test('React Native API assumption: aria-* props render on host Text', () => { aria-valuemin={0} aria-valuenow={5} aria-valuetext="ValueText" - /> + />, ); expect(screen.toJSON()).toMatchInlineSnapshot(` @@ -240,7 +240,7 @@ test('React Native API assumption: aria-* props render on host TextInput', () => aria-valuemin={0} aria-valuenow={5} aria-valuetext="ValueText" - /> + />, ); expect(screen.toJSON()).toMatchInlineSnapshot(` @@ -271,7 +271,7 @@ test('ScrollView renders correctly', () => { render( - + , ); expect(screen.toJSON()).toMatchInlineSnapshot(` @@ -289,7 +289,7 @@ test('ScrollView renders correctly', () => { test('FlatList renders correctly', () => { render( - {item}} /> + {item}} />, ); expect(screen.toJSON()).toMatchInlineSnapshot(` @@ -312,7 +312,7 @@ test('FlatList renders correctly', () => { onScrollEndDrag={[Function]} removeClippedSubviews={false} renderItem={[Function]} - scrollEventThrottle={50} + scrollEventThrottle={0.0001} stickyHeaderIndices={[]} testID="flatList" viewabilityConfigCallbackPairs={[]} diff --git a/src/__tests__/render-debug.test.tsx b/src/__tests__/render-debug.test.tsx index 988d491f3..9a57c8144 100644 --- a/src/__tests__/render-debug.test.tsx +++ b/src/__tests__/render-debug.test.tsx @@ -122,7 +122,7 @@ test('debug changing component', () => { const mockCalls = jest.mocked(console.log).mock.calls; expect(stripAnsi(mockCalls[0][0])).toMatchSnapshot( - 'bananaFresh button message should now be "fresh"' + 'bananaFresh button message should now be "fresh"', ); }); @@ -168,7 +168,7 @@ test('debug should use debugOptions from config when no option is specified', () render( hello - + , ); screen.debug(); @@ -189,7 +189,7 @@ test('debug should use given options over config debugOptions', () => { render( hello - + , ); screen.debug({ mapProps: (props) => props }); diff --git a/src/__tests__/render-hook.test.tsx b/src/__tests__/render-hook.test.tsx index f05fed915..bf6ce2fb1 100644 --- a/src/__tests__/render-hook.test.tsx +++ b/src/__tests__/render-hook.test.tsx @@ -33,7 +33,7 @@ test('allows rerendering', () => { throw new Error('No Props passed. This is a bug in the implementation'); } }, - { initialProps: { branch: 'left' } } + { initialProps: { branch: 'left' } }, ); expect(result.current).toEqual(['left', expect.any(Function)]); @@ -54,7 +54,7 @@ test('allows wrapper components', () => { }, { wrapper: Wrapper, - } + }, ); expect(result.current).toEqual('provided'); diff --git a/src/__tests__/render-string-validation.test.tsx b/src/__tests__/render-string-validation.test.tsx index 1ff6b2c2e..259e26c93 100644 --- a/src/__tests__/render-string-validation.test.tsx +++ b/src/__tests__/render-string-validation.test.tsx @@ -27,9 +27,9 @@ test('should throw when rendering a string outside a text component', () => { expect(() => render(hello, { unstable_validateStringsRenderedWithinText: true, - }) + }), ).toThrow( - `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.` + `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.`, ); }); @@ -39,7 +39,7 @@ test('should throw an error when rerendering with text outside of Text component }); expect(() => screen.rerender(hello)).toThrow( - `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.` + `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.`, ); }); @@ -63,7 +63,7 @@ test('should throw an error when strings are rendered outside Text', () => { }); expect(() => fireEvent.press(screen.getByText('Show text'))).toThrow( - `${VALIDATION_ERROR}. Detected attempt to render "text rendered outside text component" string within a component.` + `${VALIDATION_ERROR}. Detected attempt to render "text rendered outside text component" string within a component.`, ); }); @@ -73,8 +73,8 @@ test('should not throw for texts nested in fragments', () => { <>hello , - { unstable_validateStringsRenderedWithinText: true } - ) + { unstable_validateStringsRenderedWithinText: true }, + ), ).not.toThrow(); }); @@ -89,10 +89,10 @@ test(`should throw when one of the children is a text and the parent is not a Te hello hello , - { unstable_validateStringsRenderedWithinText: true } - ) + { unstable_validateStringsRenderedWithinText: true }, + ), ).toThrow( - `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.` + `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.`, ); }); @@ -102,18 +102,18 @@ test(`should throw when a string is rendered within a fragment rendered outside <>hello , - { unstable_validateStringsRenderedWithinText: true } - ) + { unstable_validateStringsRenderedWithinText: true }, + ), ).toThrow( - `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.` + `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.`, ); }); test('should throw if a number is rendered outside a text', () => { expect(() => - render(0, { unstable_validateStringsRenderedWithinText: true }) + render(0, { unstable_validateStringsRenderedWithinText: true }), ).toThrow( - `${VALIDATION_ERROR}. Detected attempt to render "0" string within a component.` + `${VALIDATION_ERROR}. Detected attempt to render "0" string within a component.`, ); }); @@ -125,10 +125,10 @@ test('should throw with components returning string value not rendered in Text', , - { unstable_validateStringsRenderedWithinText: true } - ) + { unstable_validateStringsRenderedWithinText: true }, + ), ).toThrow( - `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.` + `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.`, ); }); @@ -138,8 +138,8 @@ test('should not throw with components returning string value rendered in Text', , - { unstable_validateStringsRenderedWithinText: true } - ) + { unstable_validateStringsRenderedWithinText: true }, + ), ).not.toThrow(); }); @@ -149,9 +149,9 @@ test('should throw when rendering string in a View in a Text', () => { hello , - { unstable_validateStringsRenderedWithinText: true } - ) + { unstable_validateStringsRenderedWithinText: true }, + ), ).toThrow( - `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.` + `${VALIDATION_ERROR}. Detected attempt to render "hello" string within a component.`, ); }); diff --git a/src/__tests__/screen.test.tsx b/src/__tests__/screen.test.tsx index 0f586932e..b22e92522 100644 --- a/src/__tests__/screen.test.tsx +++ b/src/__tests__/screen.test.tsx @@ -36,7 +36,7 @@ test('screen works with nested re-mounting rerender', () => { const result = render( Mt. Everest - + , ); expect(screen).toBe(result); @@ -45,7 +45,7 @@ test('screen works with nested re-mounting rerender', () => { Śnieżka - + , ); expect(screen).toBe(result); expect(screen.getByText('Śnieżka')).toBeTruthy(); diff --git a/src/__tests__/wait-for-element-to-be-removed.test.tsx b/src/__tests__/wait-for-element-to-be-removed.test.tsx index 09586a2a4..467a8112f 100644 --- a/src/__tests__/wait-for-element-to-be-removed.test.tsx +++ b/src/__tests__/wait-for-element-to-be-removed.test.tsx @@ -83,9 +83,9 @@ test('checks if elements exist at start', async () => { expect(screen.queryByText('Observed Element')).toBeNull(); await expect( - waitForElementToBeRemoved(() => screen.queryByText('Observed Element')) + waitForElementToBeRemoved(() => screen.queryByText('Observed Element')), ).rejects.toThrow( - 'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.' + 'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.', ); }); @@ -98,7 +98,7 @@ test('waits until timeout', async () => { await expect( waitForElementToBeRemoved(() => screen.getByText('Observed Element'), { timeout: 100, - }) + }), ).rejects.toThrow('Timed out in waitForElementToBeRemoved.'); // Async action ends after 300ms and we only waited 100ms, so we need to wait for the remaining @@ -139,5 +139,5 @@ test.each([false, true])( // waitForElementToBeRemoved runs an initial call of the expectation expect(mockFn).toHaveBeenCalledTimes(4); - } + }, ); diff --git a/src/__tests__/wait-for.test.tsx b/src/__tests__/wait-for.test.tsx index a42b991de..3d059a62f 100644 --- a/src/__tests__/wait-for.test.tsx +++ b/src/__tests__/wait-for.test.tsx @@ -146,7 +146,7 @@ test.each([false, true])( const freshBananaText = await waitFor(() => screen.getByText('Fresh')); expect(freshBananaText.props.children).toBe('Fresh'); - } + }, ); test.each([false, true])( @@ -165,7 +165,7 @@ test.each([false, true])( } expect(mockFn).toHaveBeenCalledTimes(3); - } + }, ); test.each([false, true])( @@ -191,7 +191,7 @@ test.each([false, true])( expect(mockErrorFn).toHaveBeenCalledTimes(3); expect(mockHandleFn).toHaveBeenCalledTimes(1); - } + }, ); const blockThread = (timeToBlockThread: number, legacyFakeTimers: boolean) => { @@ -223,14 +223,14 @@ test.each([true, false])( await waitFor(mockErrorFn, { timeout: WAIT_FOR_TIMEOUT, interval: WAIT_FOR_INTERVAL, - }) + }), ).rejects.toThrow(); // Verify that the `waitFor` callback has been called the expected number of times // (timeout / interval + 1), so it confirms that the real duration of callback did not // cause the real clock timeout when running using fake timers. expect(mockErrorFn).toHaveBeenCalledTimes(WAIT_FOR_TIMEOUT / WAIT_FOR_INTERVAL + 1); - } + }, ); test.each([false, true])( @@ -253,7 +253,7 @@ test.each([false, true])( } expect(mockFn).toHaveBeenCalledTimes(3); - } + }, ); test.each([ @@ -306,12 +306,12 @@ test.each([ // Check that the `onPress` callback is called with the already-updated value of `syncedColor`. fireEvent.press(screen.getByText('Trigger')); expect(onPress).toHaveBeenCalledWith('red'); - } + }, ); test('waitFor throws if expectation is not a function', async () => { await expect( // @ts-expect-error intentionally passing non-function - waitFor('not a function') + waitFor('not a function'), ).rejects.toThrowErrorMatchingInlineSnapshot(`"Received \`expectation\` arg must be a function"`); }); diff --git a/src/__tests__/within.test.tsx b/src/__tests__/within.test.tsx index bb7ffd718..260714983 100644 --- a/src/__tests__/within.test.tsx +++ b/src/__tests__/within.test.tsx @@ -13,7 +13,7 @@ test('within() exposes basic queries', async () => { Same Text - + , ); expect(rootQueries.getAllByText('Same Text')).toHaveLength(2); @@ -56,7 +56,7 @@ test('within() exposes a11y queries', async () => { accessibilityHint="Same Hint" /> - + , ); expect(rootQueries.getAllByLabelText('Same Label')).toHaveLength(2); diff --git a/src/act.ts b/src/act.ts index 012f4fb29..5c44ca358 100644 --- a/src/act.ts +++ b/src/act.ts @@ -55,7 +55,7 @@ function withGlobalActEnvironment(actImplementation: ReactAct) { (error) => { setIsReactActEnvironment(previousActEnvironment); reject(error); - } + }, ); }, }; diff --git a/src/fire-event.ts b/src/fire-event.ts index 3f4d93ab9..c2be5a6c5 100644 --- a/src/fire-event.ts +++ b/src/fire-event.ts @@ -48,7 +48,7 @@ const textInputEventsIgnoringEditableProp = new Set([ export function isEventEnabled( element: ReactTestInstance, eventName: string, - nearestTouchResponder?: ReactTestInstance + nearestTouchResponder?: ReactTestInstance, ) { if (isHostTextInput(nearestTouchResponder)) { return ( @@ -73,7 +73,7 @@ export function isEventEnabled( function findEventHandler( element: ReactTestInstance, eventName: string, - nearestTouchResponder?: ReactTestInstance + nearestTouchResponder?: ReactTestInstance, ): EventHandler | null { const touchResponder = isTouchResponder(element) ? element : nearestTouchResponder; diff --git a/src/helpers/__tests__/accessiblity.test.tsx b/src/helpers/__tests__/accessiblity.test.tsx index a2efc5772..b692b9ac7 100644 --- a/src/helpers/__tests__/accessiblity.test.tsx +++ b/src/helpers/__tests__/accessiblity.test.tsx @@ -9,24 +9,24 @@ describe('isHiddenFromAccessibility', () => { isHiddenFromAccessibility( render().getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(false); expect( isHiddenFromAccessibility( render(Hello).getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(false); expect( isHiddenFromAccessibility( render().getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(false); }); @@ -40,8 +40,8 @@ describe('isHiddenFromAccessibility', () => { isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -49,14 +49,14 @@ describe('isHiddenFromAccessibility', () => { render( - + , ); expect( isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -66,8 +66,8 @@ describe('isHiddenFromAccessibility', () => { isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -75,14 +75,14 @@ describe('isHiddenFromAccessibility', () => { render( - + , ); expect( isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -94,14 +94,14 @@ describe('isHiddenFromAccessibility', () => { - + , ); expect( isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -111,8 +111,8 @@ describe('isHiddenFromAccessibility', () => { isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -120,14 +120,14 @@ describe('isHiddenFromAccessibility', () => { render( - + , ); expect( isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -137,8 +137,8 @@ describe('isHiddenFromAccessibility', () => { isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -146,14 +146,14 @@ describe('isHiddenFromAccessibility', () => { render( - + , ); expect( isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -165,14 +165,14 @@ describe('isHiddenFromAccessibility', () => { - + , ); expect( isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -181,14 +181,14 @@ describe('isHiddenFromAccessibility', () => { + />, ); expect( isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -198,8 +198,8 @@ describe('isHiddenFromAccessibility', () => { isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(false); }); @@ -208,14 +208,14 @@ describe('isHiddenFromAccessibility', () => { - + , ); expect( isHiddenFromAccessibility( screen.getByTestId('subject', { includeHiddenElements: true, - }) - ) + }), + ), ).toBe(true); }); @@ -228,10 +228,10 @@ describe('isHiddenFromAccessibility', () => { - + , ); expect( - isHiddenFromAccessibility(screen.getByTestId('subject', { includeHiddenElements: true })) + isHiddenFromAccessibility(screen.getByTestId('subject', { includeHiddenElements: true })), ).toBe(true); }); @@ -240,10 +240,10 @@ describe('isHiddenFromAccessibility', () => { - + , ); expect( - isHiddenFromAccessibility(screen.getByTestId('subject', { includeHiddenElements: true })) + isHiddenFromAccessibility(screen.getByTestId('subject', { includeHiddenElements: true })), ).toBe(true); }); @@ -256,7 +256,7 @@ describe('isHiddenFromAccessibility', () => { render( - + , ); expect(isHiddenFromAccessibility(screen.getByTestId('subject'))).toBe(false); }); @@ -269,7 +269,7 @@ describe('isHiddenFromAccessibility', () => { - + , ); expect(isHiddenFromAccessibility(screen.getByTestId('subject'))).toBe(false); }); @@ -291,7 +291,7 @@ describe('isAccessibilityElement', () => { - + , ); expect(isAccessibilityElement(screen.getByTestId('default'))).toBeFalsy(); expect(isAccessibilityElement(screen.getByTestId('true'))).toBeTruthy(); @@ -304,7 +304,7 @@ describe('isAccessibilityElement', () => { - + , ); expect(isAccessibilityElement(screen.getByTestId('default'))).toBeTruthy(); expect(isAccessibilityElement(screen.getByTestId('true'))).toBeTruthy(); @@ -321,7 +321,7 @@ describe('isAccessibilityElement', () => { False - + , ); expect(isAccessibilityElement(screen.getByTestId('default'))).toBeTruthy(); expect(isAccessibilityElement(screen.getByTestId('true'))).toBeTruthy(); @@ -334,7 +334,7 @@ describe('isAccessibilityElement', () => { - + , ); expect(isAccessibilityElement(screen.getByTestId('default'))).toBeTruthy(); expect(isAccessibilityElement(screen.getByTestId('true'))).toBeTruthy(); @@ -347,7 +347,7 @@ describe('isAccessibilityElement', () => { - + , ); expect(isAccessibilityElement(screen.getByTestId('default'))).toBeTruthy(); expect(isAccessibilityElement(screen.getByTestId('true'))).toBeTruthy(); @@ -360,7 +360,7 @@ describe('isAccessibilityElement', () => { - + , ); expect(isAccessibilityElement(screen.getByTestId('default'))).toBeTruthy(); expect(isAccessibilityElement(screen.getByTestId('true'))).toBeTruthy(); diff --git a/src/helpers/__tests__/component-tree.test.tsx b/src/helpers/__tests__/component-tree.test.tsx index c749ea6fb..0746d58ff 100644 --- a/src/helpers/__tests__/component-tree.test.tsx +++ b/src/helpers/__tests__/component-tree.test.tsx @@ -31,7 +31,7 @@ describe('getHostParent()', () => { - + , ); const hostParent = getHostParent(screen.getByTestId('subject')); @@ -52,7 +52,7 @@ describe('getHostParent()', () => { - + , ); const compositeComponent = screen.UNSAFE_getByType(MultipleHostChildren); @@ -69,7 +69,7 @@ describe('getHostChildren()', () => { Hello - + , ); const hostSubject = screen.getByTestId('subject'); @@ -91,7 +91,7 @@ describe('getHostChildren()', () => { - + , ); expect(getHostChildren(screen.getByTestId('parent'))).toEqual([ @@ -112,7 +112,7 @@ describe('getHostSelves()', () => { - + , ); const hostSubject = screen.getByTestId('subject'); @@ -137,7 +137,7 @@ describe('getHostSelves()', () => { defaultValue="TextInputValue" placeholder="TextInputPlaceholder" /> - + , ); const compositeText = screen.getByText('Text'); @@ -158,7 +158,7 @@ describe('getHostSelves()', () => { - + , ); const zeroCompositeComponent = screen.UNSAFE_getByType(ZeroHostChildren); @@ -182,7 +182,7 @@ describe('getHostSiblings()', () => { - + , ); const hostSiblings = getHostSiblings(screen.getByTestId('subject')); @@ -204,7 +204,7 @@ describe('getHostSiblings()', () => { - + , ); const compositeComponent = screen.UNSAFE_getByType(MultipleHostChildren); @@ -222,7 +222,7 @@ describe('getUnsafeRootElement()', () => { render( - + , ); const view = screen.getByTestId('view'); diff --git a/src/helpers/__tests__/text-content.test.tsx b/src/helpers/__tests__/text-content.test.tsx index 1c8a3f8bb..12936c603 100644 --- a/src/helpers/__tests__/text-content.test.tsx +++ b/src/helpers/__tests__/text-content.test.tsx @@ -16,7 +16,7 @@ test('getTextContent with single nested content', () => { render( Hello world - + , ); expect(getTextContent(screen.root)).toBe('Hello world'); }); @@ -25,7 +25,7 @@ test('getTextContent with multiple nested content', () => { render( Hello world - + , ); expect(getTextContent(screen.root)).toBe('Hello world'); }); @@ -34,7 +34,7 @@ test('getTextContent with multiple number content', () => { render( Hello world {100} - + , ); expect(getTextContent(screen.root)).toBe('Hello world 100'); }); @@ -43,7 +43,7 @@ test('getTextContent with multiple boolean content', () => { render( Hello{false} {true}world - + , ); expect(getTextContent(screen.root)).toBe('Hello world'); }); diff --git a/src/helpers/__tests__/text-input.test.tsx b/src/helpers/__tests__/text-input.test.tsx index 88606b722..77cc20191 100644 --- a/src/helpers/__tests__/text-input.test.tsx +++ b/src/helpers/__tests__/text-input.test.tsx @@ -8,7 +8,7 @@ test('getTextInputValue() throws error when invoked on non-text input', () => { const view = screen.getByTestId('view'); expect(() => getTextInputValue(view)).toThrowErrorMatchingInlineSnapshot( - `"Element is not a "TextInput", but it has type "View"."` + `"Element is not a "TextInput", but it has type "View"."`, ); }); @@ -17,6 +17,6 @@ test('isTextInputEditable() throws error when invoked on non-text input', () => const view = screen.getByTestId('view'); expect(() => isTextInputEditable(view)).toThrowErrorMatchingInlineSnapshot( - `"Element is not a "TextInput", but it has type "View"."` + `"Element is not a "TextInput", but it has type "View"."`, ); }); diff --git a/src/helpers/accessiblity.ts b/src/helpers/accessiblity.ts index 29f41a0af..4058ea934 100644 --- a/src/helpers/accessiblity.ts +++ b/src/helpers/accessiblity.ts @@ -20,7 +20,7 @@ export const accessiblityValueKeys: (keyof AccessibilityValue)[] = ['min', 'max' export function isHiddenFromAccessibility( element: ReactTestInstance | null, - { cache }: IsInaccessibleOptions = {} + { cache }: IsInaccessibleOptions = {}, ): boolean { if (element == null) { return true; @@ -172,7 +172,7 @@ export function getAccessibilityState(element: ReactTestInstance): Accessibility } export function getAccessibilityCheckedState( - element: ReactTestInstance + element: ReactTestInstance, ): AccessibilityState['checked'] { const { accessibilityState, 'aria-checked': ariaChecked } = element.props; return ariaChecked ?? accessibilityState?.checked; @@ -212,21 +212,21 @@ export function isElementBusy(element: ReactTestInstance): NonNullable { const { accessibilityState, 'aria-expanded': ariaExpanded } = element.props; return (ariaExpanded ?? accessibilityState?.expanded) === false; } export function isElementExpanded( - element: ReactTestInstance + element: ReactTestInstance, ): NonNullable { const { accessibilityState, 'aria-expanded': ariaExpanded } = element.props; return ariaExpanded ?? accessibilityState?.expanded ?? false; } export function isElementSelected( - element: ReactTestInstance + element: ReactTestInstance, ): NonNullable { const { accessibilityState, 'aria-selected': ariaSelected } = element.props; return ariaSelected ?? accessibilityState?.selected ?? false; diff --git a/src/helpers/debug-deep.ts b/src/helpers/debug-deep.ts index 6c0ebcd11..0450330e9 100644 --- a/src/helpers/debug-deep.ts +++ b/src/helpers/debug-deep.ts @@ -10,7 +10,7 @@ export type DebugOptions = { */ export default function debugDeep( instance: ReactTestRendererJSON | ReactTestRendererJSON[], - options?: DebugOptions | string + options?: DebugOptions | string, ) { const message = typeof options === 'string' ? options : options?.message; diff --git a/src/helpers/debug-shallow.ts b/src/helpers/debug-shallow.ts index fe51f5e36..510a1f402 100644 --- a/src/helpers/debug-shallow.ts +++ b/src/helpers/debug-shallow.ts @@ -8,7 +8,7 @@ import format from './format'; */ export default function debugShallow( instance: ReactTestInstance | React.ReactElement, - message?: string + message?: string, ) { const { output } = shallowInternal(instance); diff --git a/src/helpers/deprecation.ts b/src/helpers/deprecation.ts index 7d77c6d15..e6fb723ad 100644 --- a/src/helpers/deprecation.ts +++ b/src/helpers/deprecation.ts @@ -2,7 +2,7 @@ import { getQueryPrefix } from './query-name'; export function deprecateQueries>( queriesObject: Queries, - recommendation: string + recommendation: string, ): Queries { const result = {} as Queries; Object.keys(queriesObject).forEach((queryName) => { @@ -17,11 +17,11 @@ export function deprecateQueries>( function deprecateQuery any>( queryFn: QueryFn, queryName: string, - recommendation: string + recommendation: string, ): QueryFn { const formattedRecommendation = recommendation.replace( /{queryPrefix}/g, - getQueryPrefix(queryName) + getQueryPrefix(queryName), ); // @ts-expect-error: generic typing is hard diff --git a/src/helpers/errors.ts b/src/helpers/errors.ts index a23fc7e0b..3e345d0d1 100644 --- a/src/helpers/errors.ts +++ b/src/helpers/errors.ts @@ -14,7 +14,7 @@ export const prepareErrorMessage = ( // most real cases will be `Error`, but better safe than sorry error: unknown, name?: string, - value?: unknown + value?: unknown, ): string => { let errorMessage: string; if (error instanceof Error) { @@ -44,7 +44,7 @@ export const createQueryByError = (error: unknown, callsite: Function): null => // generic refining of `unknown` is very hard, you cannot do `'toString' in error` or anything like that // Converting as any with extra safe optional chaining will do the job just as well `Query: caught unknown error type: ${typeof error}, value: ${(error as any)?.toString?.()}`, - callsite + callsite, ); }; diff --git a/src/helpers/find-all.ts b/src/helpers/find-all.ts index 79a1441fa..ce7cb90f7 100644 --- a/src/helpers/find-all.ts +++ b/src/helpers/find-all.ts @@ -17,7 +17,7 @@ interface FindAllOptions { export function findAll( root: ReactTestInstance, predicate: (element: ReactTestInstance) => boolean, - options?: FindAllOptions + options?: FindAllOptions, ): HostTestInstance[] { const results = findAllInternal(root, predicate, options); @@ -37,7 +37,7 @@ export function findAll( function findAllInternal( root: ReactTestInstance, predicate: (element: ReactTestInstance) => boolean, - options?: FindAllOptions + options?: FindAllOptions, ): HostTestInstance[] { const results: HostTestInstance[] = []; diff --git a/src/helpers/format.ts b/src/helpers/format.ts index a2607e0c2..33dfb2e3f 100644 --- a/src/helpers/format.ts +++ b/src/helpers/format.ts @@ -3,7 +3,7 @@ import prettyFormat, { NewPlugin, plugins } from 'pretty-format'; export type MapPropsFunction = ( props: Record, - node: ReactTestRendererJSON + node: ReactTestRendererJSON, ) => Record; export type FormatOptions = { @@ -12,7 +12,7 @@ export type FormatOptions = { const format = ( input: ReactTestRendererJSON | ReactTestRendererJSON[], - options: FormatOptions = {} + options: FormatOptions = {}, ) => prettyFormat(input, { plugins: [getCustomPlugin(options.mapProps), plugins.ReactElement], @@ -34,7 +34,7 @@ const getCustomPlugin = (mapProps?: MapPropsFunction): NewPlugin => { indentation, depth, refs, - printer + printer, ); }, }; diff --git a/src/helpers/host-component-names.tsx b/src/helpers/host-component-names.tsx index d594f4b9d..c07623e8f 100644 --- a/src/helpers/host-component-names.tsx +++ b/src/helpers/host-component-names.tsx @@ -37,7 +37,7 @@ function detectHostComponentNames(): HostComponentNames { - + , ); return { @@ -52,14 +52,14 @@ function detectHostComponentNames(): HostComponentNames { error && typeof error === 'object' && 'message' in error ? error.message : null; throw new Error( - `Trying to detect host component names triggered the following error:\n\n${errorMessage}\n\n${userConfigErrorMessage}` + `Trying to detect host component names triggered the following error:\n\n${errorMessage}\n\n${userConfigErrorMessage}`, ); } } function getByTestId(instance: ReactTestInstance, testID: string) { const nodes = instance.findAll( - (node) => typeof node.type === 'string' && node.props.testID === testID + (node) => typeof node.type === 'string' && node.props.testID === testID, ); if (nodes.length === 0) { diff --git a/src/helpers/matchers/__tests__/match-object.test.ts b/src/helpers/matchers/__tests__/match-object.test.ts index ed937b822..45b31c221 100644 --- a/src/helpers/matchers/__tests__/match-object.test.ts +++ b/src/helpers/matchers/__tests__/match-object.test.ts @@ -3,7 +3,7 @@ import { matchObjectProp } from '../match-object-prop'; test('returns true given 2 identical objects', () => { expect(matchObjectProp({ fruit: 'banana' }, { fruit: 'banana' })).toEqual(true); expect( - matchObjectProp({ fruit: 'banana', isRipe: true }, { fruit: 'banana', isRipe: true }) + matchObjectProp({ fruit: 'banana', isRipe: true }, { fruit: 'banana', isRipe: true }), ).toEqual(true); }); @@ -20,6 +20,6 @@ test('returns false given 2 different non empty objects', () => { expect(matchObjectProp({ fruit: 'banana' }, { fruits: 'banana' })).toEqual(false); expect(matchObjectProp({ fruit: 'banana' }, { fruit: 'orange' })).toEqual(false); expect( - matchObjectProp({ fruit: 'banana', isRipe: true }, { fruit: 'banana', ripe: true }) + matchObjectProp({ fruit: 'banana', isRipe: true }, { fruit: 'banana', ripe: true }), ).toEqual(false); }); diff --git a/src/helpers/matchers/__tests__/match-string-value.test.ts b/src/helpers/matchers/__tests__/match-string-value.test.ts index a21f56077..4f068d814 100644 --- a/src/helpers/matchers/__tests__/match-string-value.test.ts +++ b/src/helpers/matchers/__tests__/match-string-value.test.ts @@ -11,5 +11,5 @@ test.each` 'returns $expectedResult given prop $prop and matcher $matcher', ({ prop, matcher, expectedResult }) => { expect(matchStringProp(prop, matcher)).toEqual(expectedResult); - } + }, ); diff --git a/src/helpers/matchers/match-accessibility-state.ts b/src/helpers/matchers/match-accessibility-state.ts index ba9e481b6..43968c8ce 100644 --- a/src/helpers/matchers/match-accessibility-state.ts +++ b/src/helpers/matchers/match-accessibility-state.ts @@ -30,7 +30,7 @@ const defaultState: AccessibilityState = { export function matchAccessibilityState( node: ReactTestInstance, - matcher: AccessibilityStateMatcher + matcher: AccessibilityStateMatcher, ) { const state = getAccessibilityState(node); return accessibilityStateKeys.every((key) => matchState(matcher, state, key)); @@ -39,7 +39,7 @@ export function matchAccessibilityState( function matchState( matcher: AccessibilityStateMatcher, state: AccessibilityState | undefined, - key: keyof AccessibilityState + key: keyof AccessibilityState, ) { return matcher[key] === undefined || matcher[key] === (state?.[key] ?? defaultState[key]); } diff --git a/src/helpers/matchers/match-accessibility-value.ts b/src/helpers/matchers/match-accessibility-value.ts index 31c387f8c..3fecfd441 100644 --- a/src/helpers/matchers/match-accessibility-value.ts +++ b/src/helpers/matchers/match-accessibility-value.ts @@ -12,7 +12,7 @@ export interface AccessibilityValueMatcher { export function matchAccessibilityValue( node: ReactTestInstance, - matcher: AccessibilityValueMatcher + matcher: AccessibilityValueMatcher, ): boolean { const value = getAccessibilityValue(node); return ( diff --git a/src/helpers/matchers/match-array-prop.ts b/src/helpers/matchers/match-array-prop.ts index bdd2cbcf8..92e05b94a 100644 --- a/src/helpers/matchers/match-array-prop.ts +++ b/src/helpers/matchers/match-array-prop.ts @@ -7,7 +7,7 @@ */ export function matchArrayProp( prop: Array | undefined, - matcher: string | Array + matcher: string | Array, ): boolean { if (!prop || matcher.length === 0) { return false; diff --git a/src/helpers/matchers/match-label-text.ts b/src/helpers/matchers/match-label-text.ts index cbfbbb78d..94d6fa01c 100644 --- a/src/helpers/matchers/match-label-text.ts +++ b/src/helpers/matchers/match-label-text.ts @@ -8,7 +8,7 @@ export function matchLabelText( root: ReactTestInstance, element: ReactTestInstance, expectedText: TextMatch, - options: TextMatchOptions = {} + options: TextMatchOptions = {}, ) { return ( matchAccessibilityLabel(element, expectedText, options) || @@ -19,7 +19,7 @@ export function matchLabelText( function matchAccessibilityLabel( element: ReactTestInstance, extpectedLabel: TextMatch, - options: TextMatchOptions + options: TextMatchOptions, ) { return matches(extpectedLabel, getAccessibilityLabel(element), options.normalizer, options.exact); } @@ -28,7 +28,7 @@ function matchAccessibilityLabelledBy( root: ReactTestInstance, nativeId: string | undefined, text: TextMatch, - options: TextMatchOptions + options: TextMatchOptions, ) { if (!nativeId) { return false; @@ -37,7 +37,7 @@ function matchAccessibilityLabelledBy( return ( findAll( root, - (node) => node.props.nativeID === nativeId && matchTextContent(node, text, options) + (node) => node.props.nativeID === nativeId && matchTextContent(node, text, options), ).length > 0 ); } diff --git a/src/helpers/matchers/match-object-prop.ts b/src/helpers/matchers/match-object-prop.ts index 6373c25ed..b1e5d8fde 100644 --- a/src/helpers/matchers/match-object-prop.ts +++ b/src/helpers/matchers/match-object-prop.ts @@ -12,7 +12,7 @@ */ export function matchObjectProp>( prop: T | undefined, - matcher: T + matcher: T, ): boolean { if (!prop || Object.keys(matcher).length === 0) { return false; diff --git a/src/helpers/matchers/match-text-content.ts b/src/helpers/matchers/match-text-content.ts index 182cb1469..41b1d126c 100644 --- a/src/helpers/matchers/match-text-content.ts +++ b/src/helpers/matchers/match-text-content.ts @@ -12,7 +12,7 @@ import { getTextContent } from '../text-content'; export function matchTextContent( node: ReactTestInstance, text: TextMatch, - options: TextMatchOptions = {} + options: TextMatchOptions = {}, ) { const textContent = getTextContent(node); const { exact, normalizer } = options; diff --git a/src/helpers/string-validation.ts b/src/helpers/string-validation.ts index 7222aa549..6f7433ffb 100644 --- a/src/helpers/string-validation.ts +++ b/src/helpers/string-validation.ts @@ -1,7 +1,7 @@ import { ReactTestRendererNode } from 'react-test-renderer'; export const validateStringsRenderedWithinText = ( - rendererJSON: ReactTestRendererNode | Array | null + rendererJSON: ReactTestRendererNode | Array | null, ) => { if (!rendererJSON) return; @@ -22,7 +22,7 @@ const validateStringsRenderedWithinTextForNode = (node: ReactTestRendererNode) = node.children?.forEach((child) => { if (typeof child === 'string') { throw new Error( - `Invariant Violation: Text strings must be rendered within a component. Detected attempt to render "${child}" string within a <${node.type}> component.` + `Invariant Violation: Text strings must be rendered within a component. Detected attempt to render "${child}" string within a <${node.type}> component.`, ); } }); diff --git a/src/helpers/timers.ts b/src/helpers/timers.ts index a9d5b7418..dcfe0f034 100644 --- a/src/helpers/timers.ts +++ b/src/helpers/timers.ts @@ -83,7 +83,7 @@ function bindTimeFunctions(): BindTimeFunctions { } const { clearTimeoutFn, setImmediateFn, setTimeoutFn } = runWithRealTimers( - bindTimeFunctions + bindTimeFunctions, ) as BindTimeFunctions; export { diff --git a/src/matchers/__tests__/to-be-busy.test.tsx b/src/matchers/__tests__/to-be-busy.test.tsx index 235558fba..8de385f42 100644 --- a/src/matchers/__tests__/to-be-busy.test.tsx +++ b/src/matchers/__tests__/to-be-busy.test.tsx @@ -11,7 +11,7 @@ test('toBeBusy() basic case', () => { - + , ); expect(screen.getByTestId('busy')).toBeBusy(); @@ -29,7 +29,7 @@ test('toBeBusy() error messages', () => { - + , ); expect(() => expect(screen.getByTestId('busy')).not.toBeBusy()) diff --git a/src/matchers/__tests__/to-be-checked.test.tsx b/src/matchers/__tests__/to-be-checked.test.tsx index 4811dc6e0..7b91130f9 100644 --- a/src/matchers/__tests__/to-be-checked.test.tsx +++ b/src/matchers/__tests__/to-be-checked.test.tsx @@ -26,7 +26,7 @@ function renderViewsWithRole(role: AccessibilityRole) { accessibilityState={{ checked: 'mixed' }} /> - + , ); } @@ -160,10 +160,10 @@ test('throws error for invalid role', () => { const unchecked = screen.getByTestId('adjustable-unchecked'); expect(() => expect(checked).toBeChecked()).toThrowErrorMatchingInlineSnapshot( - `"toBeChecked() works only on accessibility elements with "checkbox" or "radio" role."` + `"toBeChecked() works only on accessibility elements with "checkbox" or "radio" role."`, ); expect(() => expect(unchecked).not.toBeChecked()).toThrowErrorMatchingInlineSnapshot( - `"toBeChecked() works only on accessibility elements with "checkbox" or "radio" role."` + `"toBeChecked() works only on accessibility elements with "checkbox" or "radio" role."`, ); }); @@ -172,6 +172,6 @@ test('throws error for non-accessibility element', () => { const view = screen.getByTestId('test'); expect(() => expect(view).toBeChecked()).toThrowErrorMatchingInlineSnapshot( - `"toBeChecked() works only on accessibility elements with "checkbox" or "radio" role."` + `"toBeChecked() works only on accessibility elements with "checkbox" or "radio" role."`, ); }); diff --git a/src/matchers/__tests__/to-be-collapsed.test.tsx b/src/matchers/__tests__/to-be-collapsed.test.tsx index e0b067952..6c9e2e683 100644 --- a/src/matchers/__tests__/to-be-collapsed.test.tsx +++ b/src/matchers/__tests__/to-be-collapsed.test.tsx @@ -11,7 +11,7 @@ test('toBeCollapsed() basic case', () => { - + , ); expect(screen.getByTestId('expanded')).not.toBeCollapsed(); @@ -29,7 +29,7 @@ test('toBeCollapsed() error messages', () => { - + , ); expect(() => expect(screen.getByTestId('expanded')).toBeCollapsed()) diff --git a/src/matchers/__tests__/to-be-disabled.test.tsx b/src/matchers/__tests__/to-be-disabled.test.tsx index 36554d7a6..f43757cb4 100644 --- a/src/matchers/__tests__/to-be-disabled.test.tsx +++ b/src/matchers/__tests__/to-be-disabled.test.tsx @@ -27,7 +27,7 @@ test('toBeDisabled()/toBeEnabled() supports basic case', () => { - + , ); expect(screen.getByTestId('disabled-parent')).toBeDisabled(); @@ -91,7 +91,7 @@ test('toBeDisabled()/toBeEnabled() supports Pressable with "disabled" prop', () render( Button - + , ); const pressable = screen.getByTestId('subject'); @@ -162,7 +162,7 @@ test.each([ // @ts-expect-error disabled prop is not available on all Touchables Button - + , ); const touchable = screen.getByTestId('subject'); @@ -194,7 +194,7 @@ test.each([ // @ts-expect-error too generic for typescript Hello - + , ); const view = screen.getByTestId('subject'); @@ -202,7 +202,7 @@ test.each([ expect(view).not.toBeEnabled(); expect(() => expect(view).toBeEnabled()).toThrow(); expect(() => expect(view).not.toBeDisabled()).toThrow(); - } + }, ); test.each([ @@ -221,7 +221,7 @@ test.each([ // @ts-expect-error disabled prop is not available on all Touchables Hello - + , ); const view = screen.getByTestId('subject'); @@ -229,7 +229,7 @@ test.each([ expect(view).not.toBeEnabled(); expect(() => expect(view).toBeEnabled()).toThrow(); expect(() => expect(view).not.toBeDisabled()).toThrow(); - } + }, ); test('toBeDisabled()/toBeEnabled() supports "editable" prop on TextInput', () => { @@ -238,7 +238,7 @@ test('toBeDisabled()/toBeEnabled() supports "editable" prop on TextInput', () => - + , ); expect(screen.getByTestId('enabled-by-default')).not.toBeDisabled(); @@ -255,7 +255,7 @@ test('toBeDisabled()/toBeEnabled() supports "disabled" prop on Button', () => {