-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5712f28
commit 12838ab
Showing
7 changed files
with
231 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//tests for the username form component visible on landing | ||
|
||
//imports needed | ||
import { render, screen } from "@testing-library/react"; | ||
import { describe, expect, test } from "vitest"; | ||
import { UsernameForm } from "../../src/components/UsernameForm"; | ||
import userEvent from "@testing-library/user-event"; | ||
|
||
describe("Username Form", () => { | ||
|
||
//avatar selection tests | ||
test("given an avatar link it is displayed", () => { | ||
render(<UsernameForm avatar={"./testroute"}/>) | ||
const imgEl = screen.getByTestId("avatar-img") | ||
expect(imgEl).toHaveProperty('src', 'http://localhost:3000/testroute') | ||
}) | ||
|
||
//avatar dropdown | ||
test("user clicks on icon and sees the dropdown", async () => { | ||
// user sees the username form | ||
const user = userEvent.setup() | ||
render(<UsernameForm />) | ||
//user clicks on the icon | ||
const buttonEl = screen.getByTestId("select-avatar") | ||
await user.click(buttonEl) | ||
//expect dropdown to appear | ||
const dropdownEl = screen.getByTestId("avatar-dropdown") | ||
expect(dropdownEl).toBeDefined() | ||
}) | ||
|
||
}) | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.