nitropage
Version:
A free and open source, extensible visual page builder based on SolidStart.
24 lines (19 loc) • 747 B
text/typescript
import { describe, expect, it } from "vitest";
import { titleCase } from "./titleCase";
describe("titleCase", () => {
it("splits camelcase into multiple words", () => {
expect(titleCase("helloWorld")).toBe("Hello World");
});
it("upper cases the first character of each word", () => {
expect(titleCase("hello world")).toBe("Hello World");
});
it("keeps special characters, except underline", () => {
expect(titleCase("hello_world")).toBe("Hello World");
expect(titleCase("hello - world")).toBe("Hello - World");
expect(titleCase("hello-world")).toBe("Hello-World");
expect(titleCase("4/3")).toBe("4/3");
});
it("keeps single characters", () => {
expect(titleCase("helloX")).toBe("Hello X");
});
});