mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 04:10:44 +08:00
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
resolveNpmDistTagMirrorAuth,
|
|
resolveNpmPublishPlan,
|
|
shouldRequireNpmDistTagMirrorAuth,
|
|
} from "../scripts/lib/npm-publish-plan.mjs";
|
|
|
|
describe("shouldRequireNpmDistTagMirrorAuth", () => {
|
|
it("does not require npm auth for dry-run preview commands", () => {
|
|
const plan = resolveNpmPublishPlan("2026.4.1");
|
|
const auth = resolveNpmDistTagMirrorAuth({});
|
|
|
|
expect(
|
|
shouldRequireNpmDistTagMirrorAuth({
|
|
mode: "--dry-run",
|
|
mirrorDistTags: plan.mirrorDistTags,
|
|
hasAuth: auth.hasAuth,
|
|
}),
|
|
).toBe(false);
|
|
});
|
|
|
|
it("requires npm auth for real publishes that mirror dist-tags", () => {
|
|
const plan = resolveNpmPublishPlan("2026.4.1");
|
|
const auth = resolveNpmDistTagMirrorAuth({});
|
|
|
|
expect(
|
|
shouldRequireNpmDistTagMirrorAuth({
|
|
mode: "--publish",
|
|
mirrorDistTags: plan.mirrorDistTags,
|
|
hasAuth: auth.hasAuth,
|
|
}),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("does not require auth when there are no mirror dist-tags", () => {
|
|
const plan = resolveNpmPublishPlan("2026.4.1-beta.1");
|
|
const auth = resolveNpmDistTagMirrorAuth({});
|
|
|
|
expect(
|
|
shouldRequireNpmDistTagMirrorAuth({
|
|
mode: "--publish",
|
|
mirrorDistTags: plan.mirrorDistTags,
|
|
hasAuth: auth.hasAuth,
|
|
}),
|
|
).toBe(false);
|
|
});
|
|
|
|
it("does not require auth when a publish already has npm auth", () => {
|
|
const plan = resolveNpmPublishPlan("2026.4.1");
|
|
const auth = resolveNpmDistTagMirrorAuth({ npmToken: "token" });
|
|
|
|
expect(
|
|
shouldRequireNpmDistTagMirrorAuth({
|
|
mode: "--publish",
|
|
mirrorDistTags: plan.mirrorDistTags,
|
|
hasAuth: auth.hasAuth,
|
|
}),
|
|
).toBe(false);
|
|
});
|
|
});
|