feat(update): block gitea in CI and support SEAL_USE_MIRROR routing
This commit is contained in:
1 parent
b6fbd0669f
commit
df8c8c8280
3 files changed
+160
-87
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { compareSemVer, isNewerVersion } from "./update.js";
|
||||
import { compareSemVer, getMirrorMode, isNewerVersion } from "./update.js";
|
||||
|
||||
describe("update version comparator", () => {
|
||||
test("correctly identifies newer semantic versions", () => {
|
||||
@@ -19,3 +19,32 @@ describe("update version comparator", () => {
|
||||
expect(compareSemVer("0.3.3", "0.7.1")).toBe(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getMirrorMode routing", () => {
|
||||
const originalEnv = { ...process.env };
|
||||
|
||||
test("defaults to github when CI is set", () => {
|
||||
delete process.env.SEAL_USE_MIRROR;
|
||||
delete process.env.SEAL_HOME_MIRROR;
|
||||
process.env.CI = "true";
|
||||
expect(getMirrorMode()).toBe("github");
|
||||
});
|
||||
|
||||
test("defaults to auto when CI is not set", () => {
|
||||
delete process.env.SEAL_USE_MIRROR;
|
||||
delete process.env.SEAL_HOME_MIRROR;
|
||||
delete process.env.CI;
|
||||
expect(getMirrorMode()).toBe("auto");
|
||||
});
|
||||
|
||||
test("respects SEAL_USE_MIRROR override", () => {
|
||||
process.env.SEAL_USE_MIRROR = "gitea";
|
||||
expect(getMirrorMode()).toBe("gitea");
|
||||
|
||||
process.env.SEAL_USE_MIRROR = "github";
|
||||
expect(getMirrorMode()).toBe("github");
|
||||
});
|
||||
|
||||
// Restore env
|
||||
process.env = originalEnv;
|
||||
});
|
||||
Reference in new issue
Block a user