mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-06-22 14:13:49 +08:00
feat(account): record downloads and show reviews
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { render, screen } from "@testing-library/vue";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import ReviewsPanel from "@/components/ReviewsPanel.vue";
|
||||
import type { ReviewTags } from "@/global/typedefinition";
|
||||
|
||||
const tags: ReviewTags = {
|
||||
origin: "apm",
|
||||
category: "office",
|
||||
pkgname: "wps",
|
||||
version: "1.0.0",
|
||||
packageArch: "amd64",
|
||||
clientArch: "amd64",
|
||||
distro: "deepin 25",
|
||||
};
|
||||
|
||||
describe("ReviewsPanel", () => {
|
||||
it("shows anonymous login prompt and read-only review tags", () => {
|
||||
render(ReviewsPanel, {
|
||||
props: { appKey: "apm:amd64-apm:office:wps", tags, loggedIn: false },
|
||||
});
|
||||
|
||||
expect(screen.getByText("登录后发表评论")).toBeTruthy();
|
||||
expect(screen.getByText("1.0.0")).toBeTruthy();
|
||||
expect(screen.getByText("deepin 25")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -107,4 +107,44 @@ describe("processInstall queue forwarding", () => {
|
||||
expect.stringContaining('"id":5'),
|
||||
);
|
||||
});
|
||||
|
||||
it("returns queued download metadata for account records", async () => {
|
||||
vi.doMock("axios", () => ({
|
||||
default: {
|
||||
create: vi.fn(() => ({
|
||||
post: vi.fn(() => Promise.resolve({ data: { ok: true } })),
|
||||
})),
|
||||
},
|
||||
}));
|
||||
Object.assign(window.ipcRenderer, {
|
||||
on: vi.fn(),
|
||||
send: vi.fn(),
|
||||
invoke: vi.fn(() => Promise.resolve(true)),
|
||||
});
|
||||
window.apm_store.arch = "amd64";
|
||||
const { handleInstall } = await import("@/modules/processInstall");
|
||||
|
||||
const result = await handleInstall({
|
||||
name: "WPS",
|
||||
pkgname: "wps",
|
||||
version: "1.0.0",
|
||||
filename: "wps_1.0.0_amd64.deb",
|
||||
torrent_address: "",
|
||||
author: "",
|
||||
contributor: "",
|
||||
website: "",
|
||||
update: "",
|
||||
size: "",
|
||||
more: "",
|
||||
tags: "",
|
||||
img_urls: [],
|
||||
icons: "",
|
||||
category: "office",
|
||||
origin: "apm",
|
||||
currentStatus: "not-installed",
|
||||
});
|
||||
|
||||
expect(result?.pkgname).toBe("wps");
|
||||
expect(result?.origin).toBe("apm");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user