-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils_test.ts
More file actions
31 lines (27 loc) · 867 Bytes
/
utils_test.ts
File metadata and controls
31 lines (27 loc) · 867 Bytes
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
import { divideTwo } from "./utils.ts";
import { assertEquals, describe, it } from "./_dev_deps.ts";
describe("divideTwo", () => {
it("should return null if the separator does not match", () => {
const table: [string, string][] = [
["", "a"],
["abc", "d"],
["あa亜", "b"],
];
table.forEach(([input, separator]) => {
assertEquals(divideTwo(input, separator), null);
});
});
it("should return tuple", () => {
const table: [string, string, [string, string]][] = [
["", "", ["", ""]],
["abc", "", ["", "abc"]],
["abc", "a", ["", "bc"]],
["abc", "b", ["a", "c"]],
["abbc", "b", ["a", "bc"]],
["あいうえお", "う", ["あい", "えお"]],
];
table.forEach(([input, separator, expected]) => {
assertEquals(divideTwo(input, separator), expected);
});
});
});