mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-06-22 14:13:49 +08:00
feat(detail): move app details into content view
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { fireEvent, render, screen } from "@testing-library/vue";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import AppDetailPage from "@/components/AppDetailPage.vue";
|
||||
import type { App } from "@/global/typedefinition";
|
||||
|
||||
const app: App = {
|
||||
name: "WPS",
|
||||
pkgname: "wps",
|
||||
version: "1.0.0",
|
||||
filename: "wps_1.0.0_amd64.deb",
|
||||
torrent_address: "",
|
||||
author: "",
|
||||
contributor: "",
|
||||
website: "",
|
||||
update: "",
|
||||
size: "110M",
|
||||
more: "Office suite",
|
||||
tags: "office",
|
||||
img_urls: [],
|
||||
icons: "",
|
||||
category: "office",
|
||||
origin: "apm",
|
||||
currentStatus: "not-installed",
|
||||
};
|
||||
|
||||
describe("AppDetailPage", () => {
|
||||
it("renders as page, emits back, and gates favorite for anonymous users", async () => {
|
||||
const rendered = render(AppDetailPage, {
|
||||
props: {
|
||||
app,
|
||||
screenshots: [],
|
||||
sparkInstalled: false,
|
||||
apmInstalled: false,
|
||||
loggedIn: false,
|
||||
reviewAppKey: "apm:amd64-apm:office:wps",
|
||||
reviewTags: null,
|
||||
},
|
||||
});
|
||||
|
||||
expect(screen.getByText("Office suite")).toBeTruthy();
|
||||
await fireEvent.click(screen.getByRole("button", { name: "返回" }));
|
||||
await fireEvent.click(screen.getByRole("button", { name: "收藏" }));
|
||||
|
||||
expect(rendered.emitted("back")).toHaveLength(1);
|
||||
expect(rendered.emitted("request-login")?.[0]?.[0]).toBe(
|
||||
"收藏应用需要登录星火账号。",
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user