Updates
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import twuiSlugToNormalText from "./slug-to-normal-text";
|
||||
|
||||
describe("twuiSlugToNormalText", () => {
|
||||
test("returns empty string for undefined", () => {
|
||||
expect(twuiSlugToNormalText(undefined)).toBe("");
|
||||
});
|
||||
|
||||
test("returns empty string for empty string", () => {
|
||||
expect(twuiSlugToNormalText("")).toBe("");
|
||||
});
|
||||
|
||||
test("converts slug to normal text", () => {
|
||||
expect(twuiSlugToNormalText("hello-world")).toBe("Hello World");
|
||||
});
|
||||
|
||||
test("converts underscore slug to normal text", () => {
|
||||
expect(twuiSlugToNormalText("hello_world")).toBe("Hello World");
|
||||
});
|
||||
|
||||
test("handles single word", () => {
|
||||
expect(twuiSlugToNormalText("hello")).toBe("Hello");
|
||||
});
|
||||
|
||||
test("removes special characters", () => {
|
||||
expect(twuiSlugToNormalText("hello@world")).toBe("Hello World");
|
||||
});
|
||||
|
||||
test("handles multiple consecutive dashes", () => {
|
||||
expect(twuiSlugToNormalText("hello---world")).toBe("Hello World");
|
||||
});
|
||||
|
||||
test("converts to title case", () => {
|
||||
expect(twuiSlugToNormalText("annual-dues")).toBe("Annual Dues");
|
||||
});
|
||||
|
||||
test("handles alphanumeric slug", () => {
|
||||
expect(twuiSlugToNormalText("item-123")).toBe("Item 123");
|
||||
});
|
||||
|
||||
test("handles mixed case input", () => {
|
||||
expect(twuiSlugToNormalText("Hello-World")).toBe("Hello World");
|
||||
});
|
||||
|
||||
test("handles user type slug", () => {
|
||||
expect(twuiSlugToNormalText("super_admin")).toBe("Super Admin");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user