-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trying out Vitest to start adding test coverage. This PR adds vitest, scripts for running and watching tests, a simple example test, and adds a Test step to ci workflow.
- Loading branch information
1 parent
78a1a15
commit 7aba478
Showing
6 changed files
with
2,742 additions
and
56 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { expect, test } from "vitest"; | ||
import { render } from "@testing-library/react"; | ||
import { StatusIcon } from "./StatusIcon"; | ||
|
||
test("Renders green dot for active status", () => { | ||
const { container } = render(<StatusIcon status="active" />); | ||
console.log(container.firstChild.className); | ||
expect(container.firstChild.className.includes("green-600")).toBeTruthy(); | ||
}); | ||
|
||
test("Renders red dot for error status", () => { | ||
const { container } = render(<StatusIcon status="error" />); | ||
expect(container.firstChild.className.includes("red-500")).toBeTruthy(); | ||
}); | ||
|
||
test("Renders yellow dot for any other string", () => { | ||
const { container } = render(<StatusIcon status="pending" />); | ||
expect(container.firstChild.className.includes("yellow-500")).toBeTruthy(); | ||
}); | ||
|
||
test("Renders gray dot for empty string", () => { | ||
const { container } = render(<StatusIcon status="" />); | ||
expect(container.firstChild.className.includes("slate-300")).toBeTruthy(); | ||
}); |
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
Oops, something went wrong.