Skip to content

Commit 22782eb

Browse files
committed
test: add test for arrToTwConfig
1 parent 296bf49 commit 22782eb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/lib.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { describe, expect, test } from "vitest";
2+
import { arrToTwConfig } from "../src/lib/arrToTwConfig";
3+
4+
describe("arrToTwConfig", () => {
5+
const array: number[] = [0.5, 1, 2, 3, 4];
6+
7+
test("without unit", () => {
8+
expect(arrToTwConfig(array)).toEqual({
9+
0.5: "0.5",
10+
1: "1",
11+
2: "2",
12+
3: "3",
13+
4: "4",
14+
});
15+
});
16+
17+
test("with unit", () => {
18+
expect(arrToTwConfig(array, "px")).toEqual({
19+
0.5: "0.5px",
20+
1: "1px",
21+
2: "2px",
22+
3: "3px",
23+
4: "4px",
24+
});
25+
});
26+
});

0 commit comments

Comments
 (0)