Todo
This commit is contained in:
30
packages/content/src/index.test.ts
Normal file
30
packages/content/src/index.test.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from "vitest"
|
||||
|
||||
import { postSchema, upsertPostSchema } from "./index"
|
||||
|
||||
describe("content schemas", () => {
|
||||
it("accepts a valid post", () => {
|
||||
const post = postSchema.parse({
|
||||
id: "8f0cb474-4f84-4f3c-aeb5-a9f193f5f701",
|
||||
title: "Hello world",
|
||||
slug: "hello-world",
|
||||
body: "Body",
|
||||
status: "published",
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
|
||||
expect(post.slug).toBe("hello-world")
|
||||
})
|
||||
|
||||
it("rejects invalid upsert payload", () => {
|
||||
const result = upsertPostSchema.safeParse({
|
||||
title: "Hi",
|
||||
slug: "x",
|
||||
body: "",
|
||||
status: "unknown",
|
||||
})
|
||||
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
14
packages/ui/src/components/button.vitest.tsx
Normal file
14
packages/ui/src/components/button.vitest.tsx
Normal file
@ -0,0 +1,14 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { render, screen } from "@testing-library/react"
|
||||
import { describe, expect, it } from "vitest"
|
||||
|
||||
import { Button } from "./button"
|
||||
|
||||
describe("Button", () => {
|
||||
it("renders label", () => {
|
||||
render(<Button>Save</Button>)
|
||||
|
||||
expect(screen.getByRole("button", { name: "Save" })).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
@ -5,5 +5,6 @@
|
||||
"noEmit": false,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
||||
"exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.vitest.ts", "src/**/*.vitest.tsx"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user