mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { assertEquals } from "@std/assert";
|
|
import { toPascalCase } from "./mod.ts";
|
|
|
|
Deno.test("toPascalCase() handles empty string", () => {
|
|
assertEquals(toPascalCase(""), "");
|
|
});
|
|
|
|
Deno.test("toPascalCase() converts a single word", () => {
|
|
const input = "shruberry";
|
|
const expected = "Shruberry";
|
|
assertEquals(toPascalCase(input), expected);
|
|
});
|
|
|
|
Deno.test("toPascalCase() converts a sentence", () => {
|
|
const input = "she turned me into a newt";
|
|
const expected = "SheTurnedMeIntoANewt";
|
|
assertEquals(toPascalCase(input), expected);
|
|
});
|
|
|
|
Deno.test("toPascalCase() converts multiple delimiters", () => {
|
|
const result = toPascalCase("I am up-to-date!");
|
|
const expected = "IAmUpToDate";
|
|
assertEquals(result, expected);
|
|
});
|
|
|
|
Deno.test("toPascalCase() trims whitespace", () => {
|
|
const result = toPascalCase(" deno Is AWESOME ");
|
|
const expected = "DenoIsAwesome";
|
|
assertEquals(result, expected);
|
|
});
|
|
|
|
Deno.test("toPascalCase() converts a single word with Cyrillic letters", () => {
|
|
const input = "шруберри";
|
|
const expected = "Шруберри";
|
|
assertEquals(toPascalCase(input), expected);
|
|
});
|