Skip to content

Commit 7ff7ba4

Browse files
Improving tests
1 parent 54efc2b commit 7ff7ba4

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

tests/unit/util/helper.node.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
5+
import { console } from "@/util/helper";
6+
7+
describe("console", () => {
8+
test.each([
9+
["log"],
10+
["warn"],
11+
["error"],
12+
["info"],
13+
])(
14+
"has %s function",
15+
(key) => {
16+
const actual = console[key];
17+
expect(typeof actual).toEqual("function");
18+
}
19+
)
20+
});

tests/unit/util/helper.spec.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1-
import { camelize } from "@/util/helper";
2-
1+
import { camelize, console } from "@/util/helper";
32

43
describe("camelize", () => {
54
test.each([
65
["MyProp", "MyProp"],
76
["MyProp", "MyProp"],
87
["kebab-case", "kebabCase"],
98
["multi-hyphen-string", "multiHyphenString"],
10-
["drag-class", "dragClass"]
9+
["drag-class", "dragClass"],
10+
["test-", "test-"]
1111
])(
12-
"transfoem %s into %s",
12+
"transform %s into %s",
1313
(value, expected) =>{
1414
const actual = camelize(value);
1515
expect(actual).toEqual(expected);
1616
}
1717
)
18+
});
19+
20+
describe("console", () => {
21+
test.each([
22+
["log"],
23+
["warn"],
24+
["error"],
25+
["info"],
26+
])(
27+
"has %s function",
28+
(key) =>{
29+
const actual = console[key];
30+
expect(typeof actual).toEqual("function");
31+
}
32+
)
1833
});

0 commit comments

Comments
 (0)