fix(test): isolate auto-update-checker hook.test.ts to prevent checker mock leak

hook.test.ts mocks ./checker at module load time, which contaminates
checker.test.ts and invalidate-package.test.ts running in parallel in
the same CI batch. Move to hook-integration/ subdirectory for CI batch
isolation.
This commit is contained in:
YeonGyu-Kim
2026-04-04 17:24:15 +09:00
parent c91c3e6164
commit 0cc263bcd1
@@ -10,38 +10,38 @@ const mockRunBackgroundUpdateCheck = mock(async () => {})
const mockGetCachedVersion = mock(() => "3.6.0")
const mockGetLocalDevVersion = mock<(directory: string) => string | null>(() => null)
mock.module("./hook/config-errors-toast", () => ({
mock.module("../hook/config-errors-toast", () => ({
showConfigErrorsIfAny: mockShowConfigErrorsIfAny,
}))
mock.module("./hook/model-cache-warning", () => ({
mock.module("../hook/model-cache-warning", () => ({
showModelCacheWarningIfNeeded: mockShowModelCacheWarningIfNeeded,
}))
mock.module("./hook/connected-providers-status", () => ({
mock.module("../hook/connected-providers-status", () => ({
updateAndShowConnectedProvidersCacheStatus:
mockUpdateAndShowConnectedProvidersCacheStatus,
}))
mock.module("./hook/model-capabilities-status", () => ({
mock.module("../hook/model-capabilities-status", () => ({
refreshModelCapabilitiesOnStartup: mockRefreshModelCapabilitiesOnStartup,
}))
mock.module("./hook/startup-toasts", () => ({
mock.module("../hook/startup-toasts", () => ({
showLocalDevToast: mockShowLocalDevToast,
showVersionToast: mockShowVersionToast,
}))
mock.module("./hook/background-update-check", () => ({
mock.module("../hook/background-update-check", () => ({
runBackgroundUpdateCheck: mockRunBackgroundUpdateCheck,
}))
mock.module("./checker", () => ({
mock.module("../checker", () => ({
getCachedVersion: mockGetCachedVersion,
getLocalDevVersion: mockGetLocalDevVersion,
}))
mock.module("../../shared/logger", () => ({
mock.module("../../../shared/logger", () => ({
log: () => {},
}))
@@ -49,10 +49,10 @@ afterAll(() => {
mock.restore()
})
type HookFactory = typeof import("./hook").createAutoUpdateCheckerHook
type HookFactory = typeof import("../hook").createAutoUpdateCheckerHook
async function importFreshHookFactory(): Promise<HookFactory> {
const hookModule = await import(`./hook?test-${Date.now()}-${Math.random()}`)
const hookModule = await import(`../hook?test-${Date.now()}-${Math.random()}`)
return hookModule.createAutoUpdateCheckerHook
}