mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-06-22 06:03:49 +08:00
test(reviews): cover server submit failures
This commit is contained in:
@@ -101,4 +101,31 @@ describe("backend API auth exchange", () => {
|
|||||||
}),
|
}),
|
||||||
).rejects.toThrow("无法连接星火账号服务,请稍后重试。");
|
).rejects.toThrow("无法连接星火账号服务,请稍后重试。");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("maps review submission server failures separately from connection failures", async () => {
|
||||||
|
const error = Object.assign(
|
||||||
|
new Error("Request failed with status code 500"),
|
||||||
|
{
|
||||||
|
isAxiosError: true,
|
||||||
|
response: { status: 500 },
|
||||||
|
},
|
||||||
|
);
|
||||||
|
axiosMocks.post.mockRejectedValue(error);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
submitReview("apm:amd64-apm:office:wps", {
|
||||||
|
rating: 5,
|
||||||
|
content: "好用",
|
||||||
|
tags: {
|
||||||
|
origin: "apm",
|
||||||
|
category: "office",
|
||||||
|
pkgname: "wps",
|
||||||
|
version: "1.0.0",
|
||||||
|
packageArch: "amd64",
|
||||||
|
clientArch: "amd64",
|
||||||
|
distro: "deepin 25",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).rejects.toThrow("星火账号服务异常,请稍后重试。");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user