test: dedupe and optimize test suites

This commit is contained in:
Peter Steinberger
2026-02-19 15:18:50 +00:00
parent b0e55283d5
commit a1cb700a05
80 changed files with 2627 additions and 2962 deletions

View File

@@ -147,22 +147,23 @@ describe("update-startup", () => {
return { log, parsed };
}
it("logs update hint for npm installs when newer tag exists", async () => {
const { log, parsed } = await runUpdateCheckAndReadState("stable");
it.each([
{
name: "stable channel",
channel: "stable" as const,
},
{
name: "beta channel with older beta tag",
channel: "beta" as const,
},
])("logs latest update hint for $name", async ({ channel }) => {
const { log, parsed } = await runUpdateCheckAndReadState(channel);
expect(log.info).toHaveBeenCalledWith(
expect.stringContaining("update available (latest): v2.0.0"),
);
expect(parsed.lastNotifiedVersion).toBe("2.0.0");
expect(parsed.lastAvailableVersion).toBe("2.0.0");
});
it("uses latest when beta tag is older than release", async () => {
const { log, parsed } = await runUpdateCheckAndReadState("beta");
expect(log.info).toHaveBeenCalledWith(
expect.stringContaining("update available (latest): v2.0.0"),
);
expect(parsed.lastNotifiedTag).toBe("latest");
});