From c4458cf28086cf37b5b61770a3a189faab2d6afc Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 10 Apr 2026 11:08:09 +0800 Subject: [PATCH] fix: update tests for InstalledSkill new fields and missing hook mocks - Add content_hash and updated_at fields to 4 InstalledSkill literals in skill_sync.rs - Add useCheckSkillUpdates and useUpdateSkill to UnifiedSkillsPanel test mock - Suppress unused import warning in auto_launch.rs test module --- src-tauri/src/auto_launch.rs | 1 + src-tauri/tests/skill_sync.rs | 8 ++++++++ tests/components/UnifiedSkillsPanel.test.tsx | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/src-tauri/src/auto_launch.rs b/src-tauri/src/auto_launch.rs index c69ae46ad..2f44e8971 100644 --- a/src-tauri/src/auto_launch.rs +++ b/src-tauri/src/auto_launch.rs @@ -70,6 +70,7 @@ pub fn is_auto_launch_enabled() -> Result { #[cfg(test)] mod tests { + #[allow(unused_imports)] use super::*; #[cfg(target_os = "macos")] diff --git a/src-tauri/tests/skill_sync.rs b/src-tauri/tests/skill_sync.rs index 3d4cf6814..b1e0c3a61 100644 --- a/src-tauri/tests/skill_sync.rs +++ b/src-tauri/tests/skill_sync.rs @@ -110,6 +110,8 @@ fn sync_to_app_removes_disabled_and_orphaned_ssot_symlinks() { opencode: false, }, installed_at: 0, + content_hash: None, + updated_at: 0, }) .expect("save disabled skill"); @@ -154,6 +156,8 @@ fn uninstall_skill_creates_backup_before_removing_ssot() { opencode: false, }, installed_at: 123, + content_hash: None, + updated_at: 0, }) .expect("save skill"); @@ -222,6 +226,8 @@ fn restore_skill_backup_restores_files_to_ssot_and_current_app() { opencode: false, }, installed_at: 456, + content_hash: None, + updated_at: 0, }) .expect("save skill"); @@ -303,6 +309,8 @@ fn delete_skill_backup_removes_backup_directory() { opencode: false, }, installed_at: 789, + content_hash: None, + updated_at: 0, }) .expect("save skill"); diff --git a/tests/components/UnifiedSkillsPanel.test.tsx b/tests/components/UnifiedSkillsPanel.test.tsx index 9fb641c49..38518ad9b 100644 --- a/tests/components/UnifiedSkillsPanel.test.tsx +++ b/tests/components/UnifiedSkillsPanel.test.tsx @@ -64,6 +64,15 @@ vi.mock("@/hooks/useSkills", () => ({ useInstallSkillsFromZip: () => ({ mutateAsync: installFromZipMock, }), + useCheckSkillUpdates: () => ({ + data: [], + refetch: vi.fn(), + isFetching: false, + }), + useUpdateSkill: () => ({ + mutateAsync: vi.fn(), + isPending: false, + }), })); describe("UnifiedSkillsPanel", () => {