修复更新中心发送的下载项和普通下载故障覆盖的问题

This commit is contained in:
2026-04-13 13:29:58 +08:00
parent 763af5c37e
commit f044c6c3df
18 changed files with 981 additions and 39 deletions
+16 -1
View File
@@ -1,5 +1,9 @@
import { describe, it, expect, beforeEach } from "vitest";
import { downloads, removeDownloadItem } from "@/global/downloadStatus";
import {
downloads,
getNextDownloadId,
removeDownloadItem,
} from "@/global/downloadStatus";
import type { DownloadItem } from "@/global/typedefinition";
describe("downloadStatus", () => {
@@ -98,5 +102,16 @@ describe("downloadStatus", () => {
"app-3",
]);
});
it("should not reuse ids after earlier tasks are removed", () => {
downloads.value.push(createMockDownload(1, "app-1"));
const secondId = getNextDownloadId();
downloads.value.push(createMockDownload(secondId, "app-2"));
downloads.value = [];
expect(getNextDownloadId()).toBe(secondId + 1);
});
});
});