test: 修复所有已知问题并全面提高测试覆盖率至 90%

KNOWN-007: solarTime.ts 单元测试
KNOWN-008: 消除生产代码中 as any 类型断言
KNOWN-002: 工具层测试覆盖
KNOWN-003: lruCache 边界测试
KNOWN-004: templateService 分支覆盖(100%)
KNOWN-001: 6个业务组件测试
额外修复: searchOptimizer memoize bug, templateService 常量修改 bug

测试覆盖率: 75.71% -> 90.22%, 测试用例: 412 -> 671
This commit is contained in:
2026-08-13 00:09:46 +08:00
parent 5445c343b3
commit 69da92b58b
23 changed files with 3501 additions and 164 deletions
@@ -190,7 +190,7 @@ export class TemplateService {
}
async saveTemplate(template: ReportTemplate): Promise<void> {
const templates = await this.getTemplates()
const templates = [...(await this.getTemplates())]
const index = templates.findIndex(t => t.id === template.id)
if (index >= 0) {
templates[index] = template
@@ -201,7 +201,7 @@ export class TemplateService {
}
async deleteTemplate(id: string): Promise<boolean> {
const templates = await this.getTemplates()
const templates = [...(await this.getTemplates())]
const index = templates.findIndex(t => t.id === id)
if (index < 0) return false
templates.splice(index, 1)