mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
33 lines
990 B
TypeScript
33 lines
990 B
TypeScript
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||
|
|
||
|
import { assertEquals } from "@std/assert";
|
||
|
import { toCamelCase } from "./mod.ts";
|
||
|
|
||
|
Deno.test("toCamelCase() handles an empty string", () => {
|
||
|
assertEquals(toCamelCase(""), "");
|
||
|
});
|
||
|
|
||
|
Deno.test("toCamelCase() converts a single word", () => {
|
||
|
const input = "shruberry";
|
||
|
const expected = "shruberry";
|
||
|
assertEquals(toCamelCase(input), expected);
|
||
|
});
|
||
|
|
||
|
Deno.test("toCamelCase() converts a sentence", () => {
|
||
|
const input = "she turned me into a newt";
|
||
|
const expected = "sheTurnedMeIntoANewt";
|
||
|
assertEquals(toCamelCase(input), expected);
|
||
|
});
|
||
|
|
||
|
Deno.test("toCamelCase() converts multiple delimiters", () => {
|
||
|
const result = toCamelCase("I am up-to-date!");
|
||
|
const expected = "iAmUpToDate";
|
||
|
assertEquals(result, expected);
|
||
|
});
|
||
|
|
||
|
Deno.test("toCamelCase() trims whitespace", () => {
|
||
|
const result = toCamelCase(" deno Is AWESOME ");
|
||
|
const expected = "denoIsAwesome";
|
||
|
assertEquals(result, expected);
|
||
|
});
|