mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
test: give every test case an assertion of its own
SonarQube's S2699 flagged 196 test cases as assertion-less. Almost all of them end on a bare `await screen.findByText(...)`, which does throw when the text never shows up — the test is real, the analyser just cannot see it. Spelling the check out keeps the behaviour identical and makes it readable. Writing them out turned three tests red, each for a good reason: - FE-COMP-NOTES-008 read the heading out of the loading panel, which renders its own copy and swaps the whole node out once the fetch settles. It now waits for the loaded state. - FE-COMP-PHOTOPROVIDERS-014 matched /connected/i, which also matches the "Not connected" the badge starts as — the test passed whether or not the button did anything. Exact text now. - FE-FILES-002 compared an empty list against the empty list it already was. It seeds a file first, so the 500 has something to leave alone. JOURNEY-SVC-066 asserted nothing at all behind a "should not throw" comment; it now says that out loud and checks no journey entry is left orphaned.
This commit is contained in:
@@ -171,7 +171,7 @@ describe('PackingListPanel', () => {
|
||||
const user = userEvent.setup();
|
||||
render(<PackingListPanel tripId={1} items={[]} />);
|
||||
await user.click(screen.getByText('Add list'));
|
||||
await screen.findByPlaceholderText('List name (e.g. Clothing)');
|
||||
expect(await screen.findByPlaceholderText('List name (e.g. Clothing)')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-COMP-PACKING-016: delete item button exists and triggers API call', async () => {
|
||||
@@ -392,7 +392,7 @@ describe('PackingListPanel', () => {
|
||||
render(<PackingListPanel tripId={1} items={[]} />);
|
||||
|
||||
// "Apply template" button appears when templates are available
|
||||
await screen.findByText('Apply template');
|
||||
expect(await screen.findByText('Apply template')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-COMP-PACKING-031: "Uncheck All" bulk action calls PUT to uncheck checked items', async () => {
|
||||
|
||||
Reference in New Issue
Block a user