mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 13:12:26 +00:00
test(environment): consolidate serve refusals at the CLI (#11930)
This commit is contained in:
1 parent
a4a57727e9
commit
e2e3881c0e
2 files changed
+17
-31
No files matched your search
@@ -179,27 +179,6 @@ describe("loadEnvironmentSource", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("refuses a manifest whose parent is not the supplied evidence with a typed invalid request", () => {
|
||||
const fixture = environmentServeFixture();
|
||||
const other = analysisViewCaptureEvidence(analysisViewCaptureFixture());
|
||||
const projected = refusal(fixture.manifest, other);
|
||||
expect(projected).toMatchObject({
|
||||
code: "invalid_request",
|
||||
category: "invalid_input",
|
||||
details: {
|
||||
operation: "environment-serve",
|
||||
issues: [
|
||||
{
|
||||
path: ["evidence", "evidence_id"],
|
||||
reason: "invalid_value",
|
||||
expected: fixture.capture.evidence_id,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
expect(projected.message).toContain("different capture");
|
||||
});
|
||||
|
||||
it("refuses manifests of another view kind, non-capture evidence and non-Evidence JSON", async () => {
|
||||
const fixture = environmentServeFixture();
|
||||
const surface = await inspectAnalysisView({
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
environmentManifestCaptureFixture,
|
||||
} from "../../fixtures/analysisView.js";
|
||||
import {
|
||||
environmentServeFixture,
|
||||
environmentServeSource,
|
||||
writeEnvironmentServeFiles,
|
||||
} from "../../fixtures/environmentServe.js";
|
||||
@@ -23,7 +24,9 @@ describe("rea environment-serve refusals", () => {
|
||||
"refuses a manifest whose parent is not the supplied evidence with a typed invalid request",
|
||||
async ({ cli }) => {
|
||||
const root = await createTestTempDirectory("rea-environment-serve-cli-");
|
||||
const files = await writeEnvironmentServeFiles(root);
|
||||
const { manifest, capture } = environmentServeFixture();
|
||||
const manifestPath = join(root, "manifest.json");
|
||||
await writeFile(manifestPath, JSON.stringify(manifest));
|
||||
const other = join(root, "other.json");
|
||||
await writeFile(
|
||||
other,
|
||||
@@ -34,7 +37,7 @@ describe("rea environment-serve refusals", () => {
|
||||
const result = await cli.run({
|
||||
arguments: [
|
||||
"environment-serve",
|
||||
files.manifestPath,
|
||||
manifestPath,
|
||||
"--evidence",
|
||||
other,
|
||||
"--port",
|
||||
@@ -49,10 +52,17 @@ describe("rea environment-serve refusals", () => {
|
||||
category: "invalid_input",
|
||||
details: {
|
||||
operation: "environment-serve",
|
||||
issues: [{ path: ["evidence", "evidence_id"] }],
|
||||
issues: [
|
||||
{
|
||||
path: ["evidence", "evidence_id"],
|
||||
reason: "invalid_value",
|
||||
expected: capture.evidence_id,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
expect(result.stdout).toContain("different capture");
|
||||
expect(result.stderr).not.toContain("MCP transport listening");
|
||||
},
|
||||
);
|
||||
|
||||
@@ -62,9 +72,8 @@ describe("rea environment-serve refusals", () => {
|
||||
const root = await createTestTempDirectory(
|
||||
"rea-environment-serve-usage-",
|
||||
);
|
||||
const files = await writeEnvironmentServeFiles(root);
|
||||
const result = await cli.run({
|
||||
arguments: ["environment-serve", files.manifestPath, "--json"],
|
||||
arguments: ["environment-serve", join(root, "manifest.json"), "--json"],
|
||||
});
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.json).toMatchObject({
|
||||
@@ -85,13 +94,12 @@ describe("rea environment-serve refusals", () => {
|
||||
const root = await createTestTempDirectory(
|
||||
"rea-environment-serve-listener-",
|
||||
);
|
||||
const files = await writeEnvironmentServeFiles(root);
|
||||
const result = await cli.run({
|
||||
arguments: [
|
||||
"environment-serve",
|
||||
files.manifestPath,
|
||||
join(root, "manifest.json"),
|
||||
"--evidence",
|
||||
files.capturePath,
|
||||
join(root, "capture.json"),
|
||||
flag,
|
||||
"--json",
|
||||
],
|
||||
@@ -109,13 +117,12 @@ describe("rea environment-serve refusals", () => {
|
||||
"refuses an unreadable manifest path before binding",
|
||||
async ({ cli }) => {
|
||||
const root = await createTestTempDirectory("rea-environment-serve-path-");
|
||||
const files = await writeEnvironmentServeFiles(root);
|
||||
const result = await cli.run({
|
||||
arguments: [
|
||||
"environment-serve",
|
||||
join(root, "missing.json"),
|
||||
"--evidence",
|
||||
files.capturePath,
|
||||
join(root, "capture.json"),
|
||||
"--json",
|
||||
],
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user