mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-06-25 15:43:49 +08:00
feat(update-center): 实现集中式软件更新中心功能
新增更新中心模块,支持管理 APM 和传统 deb 软件更新任务 - 添加更新任务队列管理、状态跟踪和日志记录功能 - 实现更新项忽略配置持久化存储 - 新增更新确认对话框和迁移提示 - 优化主窗口关闭时的任务保护机制 - 添加单元测试覆盖核心逻辑
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
getMainWindowCloseAction,
|
||||
shouldPreventMainWindowClose,
|
||||
} from "../../../../electron/main/window-close-guard";
|
||||
|
||||
describe("main window close guard", () => {
|
||||
it("keeps the app alive while update-center work is running", () => {
|
||||
expect(
|
||||
shouldPreventMainWindowClose({
|
||||
installTaskCount: 0,
|
||||
hasRunningUpdateCenterTasks: true,
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("allows close only when both install and update-center work are idle", () => {
|
||||
expect(
|
||||
shouldPreventMainWindowClose({
|
||||
installTaskCount: 0,
|
||||
hasRunningUpdateCenterTasks: false,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("returns a hide action while any guarded work is active", () => {
|
||||
expect(
|
||||
getMainWindowCloseAction({
|
||||
installTaskCount: 1,
|
||||
hasRunningUpdateCenterTasks: false,
|
||||
}),
|
||||
).toBe("hide");
|
||||
});
|
||||
|
||||
it("returns a destroy action only when all guarded work is idle", () => {
|
||||
expect(
|
||||
getMainWindowCloseAction({
|
||||
installTaskCount: 0,
|
||||
hasRunningUpdateCenterTasks: false,
|
||||
}),
|
||||
).toBe("destroy");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user