|
1 | 1 | import { describe, expect, it, beforeAll } from "vitest"; |
2 | | -import { checkSilenceUpdate, cleanFileName, stringMatching } from "./utils"; |
| 2 | +import { checkSilenceUpdate, cleanFileName, stringMatching, toCamelCase } from "./utils"; |
3 | 3 | import { ltever, versionCompare } from "@App/pkg/utils/semver"; |
4 | 4 | import { nextTime } from "./cron"; |
5 | 5 | import dayjs from "dayjs"; |
@@ -331,3 +331,21 @@ describe.concurrent("stringMatching", () => { |
331 | 331 | }); |
332 | 332 | }); |
333 | 333 | }); |
| 334 | + |
| 335 | +describe.concurrent("toCamelCase", () => { |
| 336 | + it.concurrent("应当将蛇形命名转换为驼峰命名", () => { |
| 337 | + expect(toCamelCase("cloud_sync")).toBe("CloudSync"); |
| 338 | + expect(toCamelCase("cat_file_storage")).toBe("CatFileStorage"); |
| 339 | + expect(toCamelCase("enable_eslint")).toBe("EnableEslint"); |
| 340 | + expect(toCamelCase("eslint_config")).toBe("EslintConfig"); |
| 341 | + }); |
| 342 | + |
| 343 | + it.concurrent("应当正确处理单词配置键", () => { |
| 344 | + expect(toCamelCase("language")).toBe("Language"); |
| 345 | + }); |
| 346 | + |
| 347 | + it.concurrent("应当正确处理多下划线配置键", () => { |
| 348 | + expect(toCamelCase("editor_type_definition")).toBe("EditorTypeDefinition"); |
| 349 | + expect(toCamelCase("script_list_column_width")).toBe("ScriptListColumnWidth"); |
| 350 | + }); |
| 351 | +}); |
0 commit comments