Skip to content

Commit 3e6c875

Browse files
committed
[更改] 更改单元测试 EJS 模板,解构测试用例变量
1 parent 3ab2065 commit 3e6c875

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

creator/templates/unitTest.ts.ejs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import testCases from './testCases/<%= moduleName %>.js'
33
import { <%= leetCodeFunctionName %> } from '../src/<%= moduleName %>.js'
44

55
describe('<%= titleNumber %>. <%= titleEnglish %>', () => {
6-
testCases.forEach((testCase, index) => {
7-
test(`Test case index: ${index}, Input: ${testCase.input}`, () => {
8-
expect(<%= leetCodeFunctionName %>(testCase.input)).toEqual(testCase.expected)
6+
testCases.forEach(({ input, expected }, index) => {
7+
test(`Test case index: ${index}, Input: ${input}`, () => {
8+
expect(<%= leetCodeFunctionName %>(input)).toEqual(expected)
99
})
1010
})
1111
})

0 commit comments

Comments
 (0)