mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 08:41:13 +00:00
fix: require npm auth for dist-tag mirror
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
parseNpmPackJsonOutput,
|
||||
parseReleaseTagVersion,
|
||||
parseReleaseVersion,
|
||||
resolveNpmDistTagMirrorAuth,
|
||||
resolveNpmPublishPlan,
|
||||
resolveNpmCommandInvocation,
|
||||
utcCalendarDayDistance,
|
||||
@@ -116,6 +117,44 @@ describe("resolveNpmPublishPlan", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveNpmDistTagMirrorAuth", () => {
|
||||
it("prefers NODE_AUTH_TOKEN when both auth env vars exist", () => {
|
||||
expect(
|
||||
resolveNpmDistTagMirrorAuth({
|
||||
nodeAuthToken: "node-token",
|
||||
npmToken: "npm-token",
|
||||
}),
|
||||
).toEqual({
|
||||
hasAuth: true,
|
||||
source: "node-auth-token",
|
||||
});
|
||||
});
|
||||
|
||||
it("falls back to NPM_TOKEN when NODE_AUTH_TOKEN is missing", () => {
|
||||
expect(
|
||||
resolveNpmDistTagMirrorAuth({
|
||||
nodeAuthToken: " ",
|
||||
npmToken: "npm-token",
|
||||
}),
|
||||
).toEqual({
|
||||
hasAuth: true,
|
||||
source: "npm-token",
|
||||
});
|
||||
});
|
||||
|
||||
it("reports missing auth when neither token exists", () => {
|
||||
expect(
|
||||
resolveNpmDistTagMirrorAuth({
|
||||
nodeAuthToken: "",
|
||||
npmToken: undefined,
|
||||
}),
|
||||
).toEqual({
|
||||
hasAuth: false,
|
||||
source: "none",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("compareReleaseVersions", () => {
|
||||
it("treats stable as newer than same-day beta", () => {
|
||||
expect(compareReleaseVersions("2026.3.29", "2026.3.29-beta.2")).toBe(1);
|
||||
|
||||
Reference in New Issue
Block a user