feat(coding-agent): show update notes (#4724)
This commit is contained in:
@@ -38,7 +38,7 @@ describe("version checks", () => {
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
await expect(checkForNewPiVersion("1.2.3")).resolves.toBeUndefined();
|
||||
await expect(checkForNewPiVersion("1.2.2")).resolves.toBe("1.2.3");
|
||||
await expect(checkForNewPiVersion("1.2.2")).resolves.toEqual({ version: "1.2.3" });
|
||||
});
|
||||
|
||||
it("uses the pi.dev version check api with a pi user agent", async () => {
|
||||
@@ -57,11 +57,26 @@ describe("version checks", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("returns the active package name from the version check api", async () => {
|
||||
const fetchMock = vi.fn(async () => Response.json({ packageName: "@new-scope/pi", version: "1.2.4" }));
|
||||
it("returns the active package metadata from the version check api", async () => {
|
||||
const fetchMock = vi.fn(async () =>
|
||||
Response.json({
|
||||
packageName: "@new-scope/pi",
|
||||
version: "1.2.4",
|
||||
}),
|
||||
);
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
await expect(getLatestPiRelease("1.2.3")).resolves.toEqual({ packageName: "@new-scope/pi", version: "1.2.4" });
|
||||
await expect(getLatestPiRelease("1.2.3")).resolves.toEqual({
|
||||
packageName: "@new-scope/pi",
|
||||
version: "1.2.4",
|
||||
});
|
||||
});
|
||||
|
||||
it("returns update notes from the version check api", async () => {
|
||||
const fetchMock = vi.fn(async () => Response.json({ note: " **Read this** ", version: "1.2.4" }));
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
await expect(getLatestPiRelease("1.2.3")).resolves.toEqual({ note: "**Read this**", version: "1.2.4" });
|
||||
});
|
||||
|
||||
it("skips api calls when version checks are disabled", async () => {
|
||||
|
||||
Reference in New Issue
Block a user