Skip to content

Commit c819e10

Browse files
committed
feat: add test
1 parent 1aa726c commit c819e10

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "es2017",
3+
"target": "es2021",
44
"module": "commonjs",
55
"moduleResolution": "node",
66
"sourceMap": false,
@@ -15,7 +15,7 @@
1515
"strict": true,
1616
"outDir": "./build",
1717
"lib": [
18-
"es2015",
18+
"es2021",
1919
"dom"
2020
]
2121
},

util/generate_pools.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ const converter_code: Converter = {
1010
},
1111
}
1212

13-
function underline(s: string) {
13+
export function underline(s: string) {
1414
return s
15-
.split(' ')
16-
.map(a => a.toLowerCase())
17-
.join('_')
18-
.replace('?', '')
15+
.split(' ')
16+
.map(a => a.toLowerCase())
17+
.join('_')
18+
.replaceAll('?', '')
19+
.replaceAll('-', '_')
1920
}
2021

2122
interface CodeConfig {

util/leetcode.test.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import {underline} from "./generate_pools";
2+
3+
test("test undeline file name", () => {
4+
const a = underline("minimum-swaps-to-group-all-1s-together")
5+
expect(a).toBe("minimum_swaps_to_group_all_1s_together")
6+
})

0 commit comments

Comments
 (0)