Skip to content

Commit 139df37

Browse files
committed
chore: increase code coverage
1 parent 9f81589 commit 139df37

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/__tests__/waitFor.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,12 @@ test.each([
316316
expect(onPress).toHaveBeenCalledWith('red');
317317
}
318318
);
319+
320+
test('waitFor throws if expectation is not a function', async () => {
321+
await expect(
322+
// @ts-expect-error intentionally passing non-function
323+
waitFor('not a function')
324+
).rejects.toThrowErrorMatchingInlineSnapshot(
325+
`"Received \`expectation\` arg must be a function"`
326+
);
327+
});

src/queries/__tests__/makeQueries.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,13 @@ describe('printing element tree', () => {
231231
</View>"
232232
`);
233233
});
234+
235+
test('does not render element tree when toJSON() returns null', () => {
236+
const view = render(<View />);
237+
238+
jest.spyOn(screen, 'toJSON').mockImplementation(() => null);
239+
expect(() => view.getByText(/foo/)).toThrowErrorMatchingInlineSnapshot(
240+
`"Unable to find an element with text: /foo/"`
241+
);
242+
});
234243
});

0 commit comments

Comments
 (0)