Skip to content

Commit 51f103f

Browse files
committed
test(server): cover the @latest fallback for prerelease and unknown versions
1 parent ad0872c commit 51f103f

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎apps/server/src/provider/providerMaintenance.test.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,25 @@ it.layer(NodeServices.layer)("providerMaintenance", (it) => {
229229
updateArgs: ["install", "-g", "@example/package-tool@latest"],
230230
updateLockKey: "npm-global:/opt/node",
231231
});
232-
const advisoryFor = (maintenanceCapabilities: typeof pnpmTool) =>
232+
const advisoryFor = (
233+
maintenanceCapabilities: typeof pnpmTool,
234+
latestVersion: string | null = "1.1.0",
235+
) =>
233236
createProviderVersionAdvisory({
234237
driver: driver("packageTool"),
235238
currentVersion: "1.0.0",
236-
latestVersion: "1.1.0",
239+
latestVersion,
237240
maintenanceCapabilities,
238241
});
239242

240243
expect(advisoryFor(pnpmTool).updateCommand).toBe("pnpm add -g @example/[email protected]");
241244
expect(advisoryFor(npmTool).updateCommand).toBe("npm install -g @example/package-tool@latest");
245+
expect(advisoryFor(pnpmTool, "1.1.0-beta.1").updateCommand).toBe(
246+
"pnpm add -g @example/package-tool@latest",
247+
);
248+
expect(advisoryFor(pnpmTool, null).updateCommand).toBe(
249+
"pnpm add -g @example/package-tool@latest",
250+
);
242251
});
243252

244253
it("keeps the manual update hint when the install is behind but unowned", () => {

0 commit comments

Comments
 (0)