deno.land / std@0.224.0 / text / case_test.ts

case_test.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../assert/assert_equals.ts";import { toCamelCase, toKebabCase, toPascalCase, toSnakeCase } from "./case.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);});
Deno.test("toKebabCase() handles an empty string", () => { assertEquals(toKebabCase(""), "");});
Deno.test("toKebabCase() converts a single word", () => { const input = "shruberry"; const expected = "shruberry"; assertEquals(toKebabCase(input), expected);});
Deno.test("toKebabCase() converts a sentence", () => { const input = "she turned me into a newt"; const expected = "she-turned-me-into-a-newt"; assertEquals(toKebabCase(input), expected);});
Deno.test("toKebabCase() converts multiple delimiters", () => { const result = toKebabCase("I am up-to-date!"); const expected = "i-am-up-to-date"; assertEquals(result, expected);});
Deno.test("toKebabCase() trims whitespace", () => { const result = toKebabCase(" deno Is AWESOME "); const expected = "deno-is-awesome"; assertEquals(result, expected);});
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("toSnakeCase() handles an empty string", () => { assertEquals(toSnakeCase(""), "");});
Deno.test("toSnakeCase() converts a single word", () => { const input = "shruberry"; const expected = "shruberry"; assertEquals(toSnakeCase(input), expected);});
Deno.test("toSnakeCase() converts a sentence", () => { const input = "she turned me into a newt"; const expected = "she_turned_me_into_a_newt"; assertEquals(toSnakeCase(input), expected);});
Deno.test("toSnakeCase() converts multiple delimiters", () => { const result = toSnakeCase("I am up-to-date!"); const expected = "i_am_up_to_date"; assertEquals(result, expected);});
Deno.test("toSnakeCase() trims whitespace", () => { const result = toSnakeCase(" deno Is AWESOME "); const expected = "deno_is_awesome"; assertEquals(result, expected);});
std

Version Info

Tagged at
6 months ago