mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-19 10:52:04 +00:00
feat: setup vitest
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -7,7 +7,9 @@
|
||||
"build": "vite build && tsgo",
|
||||
"preview": "vite preview",
|
||||
"check": "biome check",
|
||||
"fix": "biome check --fix"
|
||||
"fix": "biome check --fix",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-ec2": "^3.1004.0",
|
||||
@@ -34,6 +36,9 @@
|
||||
"@biomejs/biome": "^2.4.6",
|
||||
"@tailwindcss/vite": "^4.2.1",
|
||||
"@tanstack/router-plugin": "^1.166.2",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@types/node": "24.12.0",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
@@ -41,9 +46,11 @@
|
||||
"@vitejs/plugin-basic-ssl": "^2.1.4",
|
||||
"@vitejs/plugin-react": "^5.1.4",
|
||||
"babel-plugin-react-compiler": "^1.0.0",
|
||||
"jsdom": "^28.1.0",
|
||||
"typescript": "^5.9.3",
|
||||
"ultracite": "^7.2.5",
|
||||
"vite": "^7.3.1"
|
||||
"vite": "^7.3.1",
|
||||
"vitest": "^4.0.18"
|
||||
},
|
||||
"packageManager": "pnpm@10.30.3+sha512.c961d1e0a2d8e354ecaa5166b822516668b7f44cb5bd95122d590dd81922f606f5473b6d23ec4a5be05e7fcd18e8488d47d978bbe981872f1145d06e9a740017"
|
||||
}
|
||||
|
||||
+761
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
import { render, screen } from "@testing-library/react"
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { PageHeading } from "./page-heading"
|
||||
|
||||
describe("PageHeading", () => {
|
||||
it("renders the title", () => {
|
||||
render(<PageHeading title="Instances" />)
|
||||
expect(screen.getByText("Instances")).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("renders the subtitle when provided", () => {
|
||||
render(<PageHeading title="Instances" subtitle="Manage your EC2 instances" />)
|
||||
expect(screen.getByText("Manage your EC2 instances")).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("does not render a subtitle when not provided", () => {
|
||||
render(<PageHeading title="Instances" />)
|
||||
expect(screen.queryByText("Manage your EC2 instances")).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("renders actions when provided", () => {
|
||||
render(<PageHeading title="Instances" actions={<button type="button">Launch</button>} />)
|
||||
expect(screen.getByText("Launch")).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,7 @@
|
||||
import { cleanup } from "@testing-library/react"
|
||||
import "@testing-library/jest-dom/vitest"
|
||||
import { afterEach } from "vitest"
|
||||
|
||||
afterEach(() => {
|
||||
cleanup()
|
||||
})
|
||||
@@ -1,3 +1,4 @@
|
||||
/// <reference types="vitest/config" />
|
||||
import { fileURLToPath, URL } from "node:url"
|
||||
|
||||
import tailwindcss from "@tailwindcss/vite"
|
||||
@@ -42,4 +43,9 @@ export default defineConfig({
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
},
|
||||
},
|
||||
test: {
|
||||
globals: true,
|
||||
environment: "jsdom",
|
||||
setupFiles: "./src/test/setup.ts",
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user