Skip to content

test: add unit tests for Hooks, IPC, Backup/Restore, EventListener (#350)#351

Merged
JusterZhu merged 1 commit into
masterfrom
test/unit-tests-refactored
May 24, 2026
Merged

test: add unit tests for Hooks, IPC, Backup/Restore, EventListener (#350)#351
JusterZhu merged 1 commit into
masterfrom
test/unit-tests-refactored

Conversation

@JusterZhu

@JusterZhu JusterZhu commented May 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

添加了13个新的单元测试,覆盖v2重构中涉及的核心组件。

新增测试

HooksTests (3 tests)

  • NoOpUpdateHooks 默认返回值
  • UpdateContext record 相等性
  • DownloadContext record 相等性

ProcessInfoProviderTests (2 tests)

  • EncryptedFileProcessInfoProvider 发送/接收往返
  • 无文件时返回null

BackupRestoreTests (3 tests)

  • Backup + Restore 完整往返
  • CleanBackup 只保留最近N个版本
  • ListBackups 返回元数据

EventListenerTests (5 tests)

  • EventManager 添加/移除/分发监听器
  • 多个监听器同时调用
  • ProgressEventArgs 构造
  • 所有 EventArgs 类型构造

测试结果

  • CoreTest: 54/55 ✅ (1个预存失败)
  • ClientCoreTest: 20/20 ✅
  • DifferentialTest: 62/62 ✅
  • BowlTest: 50/50 ✅
  • 总计: 186/187 通过

额外修复

  • 移除 Core.csproj 中 netstandard2.0 不支持的 IsTrimmable

Closes #350

- HooksTests: NoOpUpdateHooks defaults, UpdateContext/DownloadContext record equality
- ProcessInfoProviderTests: EncryptedFile send/receive roundtrip, no-file returns null
- BackupRestoreTests: backup+restore roundtrip, CleanBackup keeps N versions, ListBackups metadata
- EventListenerTests: add/remove/dispatch, multiple listeners, progress args, event args constructors
- Removed IsTrimmable from Core.csproj (not supported on netstandard2.0)

Test results: CoreTest 54/55 (1 pre-existing failure), ClientCoreTest 20/20, DifferentialTest 62/62, BowlTest 50/50

Closes #350
Copilot AI review requested due to automatic review settings May 24, 2026 08:17
@JusterZhu JusterZhu added the refactor Refactor some existing code. label May 24, 2026
@JusterZhu JusterZhu merged commit 4708827 into master May 24, 2026
1 check failed
@JusterZhu JusterZhu deleted the test/unit-tests-refactored branch May 24, 2026 08:18
@JusterZhu JusterZhu removed the request for review from Copilot May 24, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactor some existing code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T5: Test supplementation — unit tests for refactored components

1 participant