mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
test(wait-for-element-to-be-removed): error when element is already removed at call time
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import { waitForElementToBeRemoved } from '..';
|
||||
|
||||
it('throws error when element is already removed at the time of calling', async () => {
|
||||
await expect(waitForElementToBeRemoved(() => null)).rejects.toThrow(
|
||||
'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.',
|
||||
);
|
||||
});
|
||||
@@ -7,3 +7,4 @@ test(queries/label-text): Validates getByLabelText finds elements by their acces
|
||||
test(queries/hint-text): Validates getByHintText finds elements by their accessibility hint with exact matching - critical for testing accessibility where hints provide additional context to screen readers. Coverage: 97.93% statements (was 93.81%), 83.33% branches, 66.66% functions for hint-text.ts. Covered getNodeByHintText function with exact option and query logic. Uncovered: error message functions (getMultipleError, getMissingError).
|
||||
test(queries/test-id): Validates getByTestId with exact:false option for partial testID matching - critical for testing components with dynamic or prefixed testIDs. Coverage: 96.42% statements (was 89.28%), 83.33% branches, 66.66% functions for test-id.ts. Covered matchTestId function with exact option and queryAllByTestId implementation. Uncovered: error message functions (getMultipleError, getMissingError).
|
||||
test(wait-for): Validates waitFor timeout behavior when expectation never passes - critical error handling users depend on when async conditions fail. Coverage: 55% statements (was 12%), 43.47% branches, 85.71% functions for wait-for.ts. Covered timeout error path and lastError handling. Uncovered: fake timers path, promise-returning expectations, onTimeout callback, timer switching errors.
|
||||
test(wait-for-element-to-be-removed): Validates error when element is already removed at call time - critical error handling users depend on when misusing the API. Coverage: 61.9% statements (was 9.52%), 66.66% branches, 100% functions for wait-for-element-to-be-removed.ts. Covered isRemoved helper and initial validation error path. Uncovered: wait logic (lines 27-42).
|
||||
|
||||
Reference in New Issue
Block a user