源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import assert from "node:assert/strict"
|
||||
import { spawnSync } from "node:child_process"
|
||||
import { fileURLToPath } from "node:url"
|
||||
import test from "node:test"
|
||||
import { createCliScenario } from "../src/cli-scenario.js"
|
||||
|
||||
test("CLI rejects an unknown active fault before starting the server", () => {
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
["--import", "tsx", fileURLToPath(new URL("../src/cli.ts", import.meta.url))],
|
||||
{
|
||||
encoding: "utf8",
|
||||
env: {
|
||||
...process.env,
|
||||
PROFILE_ID: "synthetic-enterprise-oauth-mcp",
|
||||
ACTIVE_FAULT_ID: "not-a-real-fault",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
assert.equal(result.status, 1)
|
||||
assert.match(result.stderr, /Invalid ACTIVE_FAULT_ID 'not-a-real-fault'/)
|
||||
assert.match(result.stderr, /Valid ids: .*oauth-missing-auth-challenge/)
|
||||
})
|
||||
|
||||
test("CLI scenario activates a known fault with the always trigger", () => {
|
||||
const scenario = createCliScenario("synthetic-enterprise-oauth-mcp", "oauth-issuer-mismatch")
|
||||
|
||||
assert.deepEqual(scenario.activeFault, {
|
||||
id: "oauth-issuer-mismatch",
|
||||
trigger: { occurrence: "always" },
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user