Skip to content

Commit

Permalink
[frontend] feat: Login spinner and error text
Browse files Browse the repository at this point in the history
  • Loading branch information
helloitsdave committed Mar 24, 2024
1 parent ca4512e commit 8c8702b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/src/components/Login.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,14 @@ describe("Login", () => {
expect(localStorage.getItem("token")).toBe("test");
});
});
test('Should show error message on failed login', async () => {
render(<Login {...props}/>);
userEvent.type(screen.getByPlaceholderText("Username"), "wronguser");
userEvent.type(screen.getByPlaceholderText("Password"), "wrongpassword");
userEvent.click(screen.getByText("Login"));

await waitFor(() => {
expect(screen.getByText("An error occurred. Please retry")).toBeInTheDocument();
});
});
});

1 comment on commit 8c8702b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

91.58%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   App.tsx0%0%0%1, 1, 10–19, 2, 20–27, 3–9
   NoteApp.tsx94.12%100%96.69%66–70
src/api
   apiService.ts100%100%100%
src/components
   Header.tsx0%0%0%1, 1–9
   Login.tsx80%100%98.57%33, 33–34
   Note.tsx100%100%100%
   NoteForm.tsx100%100%100%
   NoteFormModal.tsx100%100%100%
   NoteGrid.tsx100%100%100%
   Spinner.tsx100%100%100%

Please sign in to comment.