-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test cases for scoreboard components
- Loading branch information
Showing
7 changed files
with
68 additions
and
16 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/components/scoreboard/components/level/__snapshots__/level.test.tsx.snap
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,26 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Level component test case should render level correctly 1`] = ` | ||
<DocumentFragment> | ||
<select | ||
class="selectLevel" | ||
role="select-component" | ||
> | ||
<option | ||
class="optionLevel" | ||
> | ||
beginner | ||
</option> | ||
<option | ||
class="optionLevel" | ||
> | ||
intermediate | ||
</option> | ||
<option | ||
class="optionLevel" | ||
> | ||
expert | ||
</option> | ||
</select> | ||
</DocumentFragment> | ||
`; |
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,23 @@ | ||
import { Level } from "@components/scoreboard/components"; | ||
import { render, screen } from "@testing-library/react"; | ||
import userEvent from "@testing-library/user-event"; | ||
import React from "react"; | ||
|
||
describe("Level component test case", function () { | ||
it("should render level correctly", function () { | ||
const onChange = jest.fn(); | ||
const levelData = ["beginner", "intermediate", "expert"]; | ||
const { asFragment } = render(<Level levelData={levelData} onChange={onChange} />); | ||
|
||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
it("should Select level behaviour", function () { | ||
const onChange = jest.fn(); | ||
const levelData = ["beginner", "intermediate", "expert"]; | ||
render(<Level levelData={levelData} onChange={onChange} />); | ||
|
||
userEvent.selectOptions(screen.getByRole("select-component"), "intermediate"); | ||
expect(screen.getByRole("option", { name: "intermediate" })).toBeEnabled(); | ||
}); | ||
}); |
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 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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
.wrapperScoreboard { | ||
display: flex; | ||
width: max-content; | ||
padding-bottom: 2vw; | ||
width: 100%; | ||
justify-content: space-between; | ||
} |
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