mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-19 05:32:19 +03:00
Merge branch 'release/v3.8.50' into feat/6674-gpt4free-batch-3-providers
This commit is contained in:
@@ -55,11 +55,7 @@ test("D1: blacklisted IP is blocked on a DIRECT connection (trusted peer stamp,
|
||||
{ enforce: true }
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
res.status,
|
||||
403,
|
||||
`direct blacklisted IP must be blocked, got status=${res.status}`
|
||||
);
|
||||
assert.equal(res.status, 403, `direct blacklisted IP must be blocked, got status=${res.status}`);
|
||||
});
|
||||
|
||||
test("D2: persisted config written after first load is honored WITHOUT restart", async () => {
|
||||
@@ -74,9 +70,7 @@ test("D2: persisted config written after first load is honored WITHOUT restart",
|
||||
// Now simulate a "settings route" write: write directly to the DB key_value table
|
||||
// with a DIFFERENT config (e.g. empty blacklist, effectively "allow all").
|
||||
const db = core.getDbInstance();
|
||||
db.prepare(
|
||||
"INSERT OR REPLACE INTO key_value (namespace, key, value) VALUES (?, ?, ?)"
|
||||
).run(
|
||||
db.prepare("INSERT OR REPLACE INTO key_value (namespace, key, value) VALUES (?, ?, ?)").run(
|
||||
"ipFilter",
|
||||
"config",
|
||||
JSON.stringify({ enabled: true, mode: "blacklist", blacklist: [], whitelist: [] })
|
||||
@@ -116,13 +110,11 @@ test("D3: behind reverse proxy (peer stamp=loopback + via-proxy marker + XFF=bla
|
||||
});
|
||||
|
||||
test("Bonus: ipFilterModeSchema accepts whitelist-priority", async () => {
|
||||
const { ipFilterModeSchema } = await import(
|
||||
"../../../src/shared/validation/schemas/misc.ts"
|
||||
);
|
||||
const { ipFilterModeSchema } = await import("../../../src/shared/validation/schemas/misc.ts");
|
||||
const result = ipFilterModeSchema.safeParse("whitelist-priority");
|
||||
assert.equal(
|
||||
result.success,
|
||||
true,
|
||||
`ipFilterModeSchema must accept "whitelist-priority", got: ${JSON.stringify(result)}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -404,7 +404,7 @@ test("resolveProjectRoot walks up from start dir to nearest package.json or .git
|
||||
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-root-"));
|
||||
const subDir = path.join(tempRoot, "sub", "deep");
|
||||
fs.mkdirSync(subDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(tempRoot, "package.json"), "{}");
|
||||
fs.writeFileSync(path.join(tempRoot, "package.json"), JSON.stringify({ name: "omniroute" }));
|
||||
|
||||
try {
|
||||
// Walking up from a deep subdir that does not have markers must find the real root.
|
||||
|
||||
27
tests/unit/management-auth-docs.test.ts
Normal file
27
tests/unit/management-auth-docs.test.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { describe, it } from "node:test";
|
||||
import { ok } from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
describe("Management auth documentation (#7786)", () => {
|
||||
const docPath = "docs/guides/MANAGEMENT-AUTH.md";
|
||||
const content = readFileSync(docPath, "utf-8");
|
||||
|
||||
it("exists and has content", () => {
|
||||
ok(content.length > 500, "should have substantial content");
|
||||
ok(content.includes("Dashboard JWT session"));
|
||||
ok(content.includes("CLI machine-id token"));
|
||||
ok(content.includes("oma_"));
|
||||
});
|
||||
|
||||
it("documents all four credential families", () => {
|
||||
const families = ["Dashboard JWT", "CLI machine-id", "oma_", "Manage-scope"];
|
||||
for (const f of families) {
|
||||
ok(content.includes(f), `should document ${f}`);
|
||||
}
|
||||
});
|
||||
|
||||
it("mentions relevant auth header examples", () => {
|
||||
ok(content.includes("Authorization"));
|
||||
ok(content.includes("Bearer"));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user