mirror of
https://github.com/oxynote/oxynote.git
synced 2026-10-17 19:09:19 +02:00
35 lines
744 B
TypeScript
35 lines
744 B
TypeScript
import { describe, it } from "vitest"
|
|
import { cleanSentenceCase } from "./string"
|
|
|
|
describe("cleanSentenceCase", () => {
|
|
it.for([
|
|
{
|
|
name: "capitalizes the first letter",
|
|
input: "hello world",
|
|
expected: "Hello world",
|
|
},
|
|
{
|
|
name: "returns an empty string unchanged",
|
|
input: "",
|
|
expected: "",
|
|
},
|
|
{
|
|
name: "keeps an already capitalized string unchanged",
|
|
input: "Hello",
|
|
expected: "Hello",
|
|
},
|
|
{
|
|
name: "capitalizes a single-character string",
|
|
input: "a",
|
|
expected: "A",
|
|
},
|
|
{
|
|
name: "leaves a non-letter first character unchanged",
|
|
input: "1st item",
|
|
expected: "1st item",
|
|
},
|
|
])("$name", ({ input, expected }, { expect }) => {
|
|
expect(cleanSentenceCase(input)).toBe(expected)
|
|
})
|
|
})
|