refactor(auth): remove keys auth module and align tests
- remove server auth module and client keys page/routes/api to simplify flow - update mcp and scenario tests to match uuid routes and step schema
This commit is contained in:
@@ -29,7 +29,6 @@ jest.mock("@nestjs/common", () => {
|
||||
return actual;
|
||||
});
|
||||
|
||||
import { AuthModule } from "../src/auth/auth.module";
|
||||
import { BrowserModule } from "../src/browser/browser.module";
|
||||
import { SessionModule } from "../src/session/session.module";
|
||||
import { EnvironmentModule } from "../src/environment/environment.module";
|
||||
@@ -42,6 +41,9 @@ import { ScenarioStepEntity } from "../src/scenario/scenario-step.entity";
|
||||
import { ScenarioRunEntity } from "../src/scenario/scenario-run.entity";
|
||||
import { ScenarioRunStepEntity } from "../src/scenario/scenario-run-step.entity";
|
||||
import { ScenarioRunLogEntity } from "../src/scenario/scenario-run-log.entity";
|
||||
import { ScenarioCredentialEntity } from "../src/scenario/scenario-credential.entity";
|
||||
import { CredentialEntity } from "../src/credential/credential.entity";
|
||||
import { SnippetEntity } from "../src/snippet/snippet.entity";
|
||||
import { HealthController } from "../src/health/health.controller";
|
||||
import { HttpExceptionFilter } from "../src/filters/http-exception.filter";
|
||||
import { LoggingInterceptor } from "../src/interceptors/logging.interceptor";
|
||||
@@ -66,11 +68,13 @@ export async function buildTestApp(): Promise<INestApplication> {
|
||||
ScenarioRunEntity,
|
||||
ScenarioRunStepEntity,
|
||||
ScenarioRunLogEntity,
|
||||
ScenarioCredentialEntity,
|
||||
CredentialEntity,
|
||||
SnippetEntity,
|
||||
],
|
||||
synchronize: true,
|
||||
}),
|
||||
ScheduleModule.forRoot(),
|
||||
AuthModule,
|
||||
BrowserModule,
|
||||
SessionModule,
|
||||
EnvironmentModule,
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
import { INestApplication } from "@nestjs/common";
|
||||
import request from "supertest";
|
||||
import { buildTestApp } from "./app.harness";
|
||||
|
||||
/**
|
||||
* Auth controller integration tests.
|
||||
*
|
||||
* The login endpoint requires a live browser + real key files, so it is not
|
||||
* exercised here (those belong to e2e tests with real credentials).
|
||||
* We cover the parts that can be tested without external dependencies.
|
||||
*/
|
||||
describe("AuthController", () => {
|
||||
let app: INestApplication;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await buildTestApp();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await app.close();
|
||||
});
|
||||
|
||||
// ── GET /keys ──────────────────────────────────────────────────────────────
|
||||
|
||||
describe("GET /keys", () => {
|
||||
it("returns 200 with a keys array", async () => {
|
||||
const res = await request(app.getHttpServer()).get("/keys").expect(200);
|
||||
expect(res.body).toHaveProperty("keys");
|
||||
expect(Array.isArray(res.body.keys)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
// ── POST /login ────────────────────────────────────────────────────────────
|
||||
|
||||
describe("POST /login", () => {
|
||||
it("returns 400 when body is empty", async () => {
|
||||
await request(app.getHttpServer()).post("/login").send({}).expect(400);
|
||||
});
|
||||
|
||||
it("returns 400 when key is missing", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.post("/login")
|
||||
.send({ environmentName: "test-env" })
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
it("returns 400 when environmentName is missing", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.post("/login")
|
||||
.send({ key: "some-key" })
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
it("returns 400 when key file does not exist", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.post("/login")
|
||||
.send({ key: "nonexistent-key", environmentName: "test-env" })
|
||||
.expect(404); // NotFoundException for missing environment
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -160,7 +160,7 @@ describe("EnvironmentController", () => {
|
||||
});
|
||||
|
||||
it("returns 404 for unknown id", async () => {
|
||||
await request(app.getHttpServer()).get("/environments/99999").expect(404);
|
||||
await request(app.getHttpServer()).get("/environments/00000000-0000-0000-0000-000000000001").expect(404);
|
||||
});
|
||||
|
||||
it("returns 400 for non-numeric id", async () => {
|
||||
@@ -187,7 +187,7 @@ describe("EnvironmentController", () => {
|
||||
|
||||
it("returns 404 for unknown id", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.patch("/environments/99999")
|
||||
.patch("/environments/00000000-0000-0000-0000-000000000001")
|
||||
.send({ name: "x" })
|
||||
.expect(404);
|
||||
});
|
||||
@@ -213,7 +213,7 @@ describe("EnvironmentController", () => {
|
||||
|
||||
it("returns 404 for unknown id", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.delete("/environments/99999")
|
||||
.delete("/environments/00000000-0000-0000-0000-000000000001")
|
||||
.expect(404);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -69,14 +69,14 @@ describe("McpController", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ── list_keys tool ─────────────────────────────────────────────────────────
|
||||
// ── list_keys tool (removed) ──────────────────────────────────────────────
|
||||
|
||||
describe("list_keys", () => {
|
||||
it("returns a result with text content containing a JSON array", async () => {
|
||||
it("returns MCP error for removed tool", async () => {
|
||||
const { status, rpc } = await mcpCall("list_keys");
|
||||
expect(status).toBe(200);
|
||||
const result = rpc.result as { content: { text: string }[] };
|
||||
expect(Array.isArray(JSON.parse(result.content[0].text))).toBe(true);
|
||||
const result = rpc.result as { isError: boolean; content?: { text: string }[] };
|
||||
expect(result.isError).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -42,21 +42,20 @@ describe("ScenarioRunStepEntity.output + helpers.getStepOutput", () => {
|
||||
}
|
||||
|
||||
/** Create a scenario and return its id. */
|
||||
async function createScenario(name = "output-scenario"): Promise<number> {
|
||||
async function createScenario(name = "output-scenario"): Promise<string> {
|
||||
const sc = await scenarioService.create({ name });
|
||||
return sc.id;
|
||||
}
|
||||
|
||||
/** Create a step and return its id. */
|
||||
async function createStep(
|
||||
scenarioId: number,
|
||||
scenarioId: string,
|
||||
order: number,
|
||||
execCode: string,
|
||||
sessionName = "output-test-session",
|
||||
): Promise<number> {
|
||||
): Promise<string> {
|
||||
const step = await scenarioService.createStep(scenarioId, {
|
||||
order,
|
||||
type: "exec",
|
||||
sessionName,
|
||||
execCode,
|
||||
});
|
||||
@@ -64,7 +63,7 @@ describe("ScenarioRunStepEntity.output + helpers.getStepOutput", () => {
|
||||
}
|
||||
|
||||
/** Trigger a run and process it to completion via the scheduler. */
|
||||
async function runScenario(scenarioId: number): Promise<number> {
|
||||
async function runScenario(scenarioId: string): Promise<string> {
|
||||
const run = await scenarioService.createRun(scenarioId);
|
||||
// Drive the scheduler directly — keeps tests synchronous and fast.
|
||||
await scheduler.pickUpPendingRuns();
|
||||
@@ -84,7 +83,7 @@ describe("ScenarioRunStepEntity.output + helpers.getStepOutput", () => {
|
||||
const runId = await runScenario(scId);
|
||||
|
||||
const row = await dataSource.query(
|
||||
`SELECT output, status FROM scenario_run_steps WHERE runId = ${runId}`,
|
||||
`SELECT output, status FROM scenario_run_steps WHERE runId = '${runId}'`,
|
||||
);
|
||||
expect(row[0].status).toBe("pass");
|
||||
expect(JSON.parse(row[0].output as string)).toBe(42);
|
||||
@@ -98,7 +97,7 @@ describe("ScenarioRunStepEntity.output + helpers.getStepOutput", () => {
|
||||
const runId = await runScenario(scId);
|
||||
|
||||
const row = await dataSource.query(
|
||||
`SELECT output FROM scenario_run_steps WHERE runId = ${runId}`,
|
||||
`SELECT output FROM scenario_run_steps WHERE runId = '${runId}'`,
|
||||
);
|
||||
expect(JSON.parse(row[0].output as string)).toEqual({ foo: "bar", n: 7 });
|
||||
});
|
||||
@@ -111,7 +110,7 @@ describe("ScenarioRunStepEntity.output + helpers.getStepOutput", () => {
|
||||
const runId = await runScenario(scId);
|
||||
|
||||
const row = await dataSource.query(
|
||||
`SELECT output FROM scenario_run_steps WHERE runId = ${runId}`,
|
||||
`SELECT output FROM scenario_run_steps WHERE runId = '${runId}'`,
|
||||
);
|
||||
expect(row[0].output).toBeNull();
|
||||
});
|
||||
@@ -140,7 +139,7 @@ describe("ScenarioRunStepEntity.output + helpers.getStepOutput", () => {
|
||||
|
||||
const runId = await runScenario(scId);
|
||||
const rows = await dataSource.query(
|
||||
`SELECT "order", output FROM scenario_run_steps WHERE runId = ${runId} ORDER BY "order"`,
|
||||
`SELECT "order", output FROM scenario_run_steps WHERE runId = '${runId}' ORDER BY "order"`,
|
||||
);
|
||||
|
||||
expect(JSON.parse(rows[0].output as string)).toBe(99);
|
||||
@@ -156,7 +155,7 @@ describe("ScenarioRunStepEntity.output + helpers.getStepOutput", () => {
|
||||
|
||||
const runId = await runScenario(scId);
|
||||
const rows = await dataSource.query(
|
||||
`SELECT "order", output FROM scenario_run_steps WHERE runId = ${runId} ORDER BY "order"`,
|
||||
`SELECT "order", output FROM scenario_run_steps WHERE runId = '${runId}' ORDER BY "order"`,
|
||||
);
|
||||
|
||||
expect(JSON.parse(rows[1].output as string)).toBe("step-zero");
|
||||
@@ -170,7 +169,7 @@ describe("ScenarioRunStepEntity.output + helpers.getStepOutput", () => {
|
||||
|
||||
const runId = await runScenario(scId);
|
||||
const row = await dataSource.query(
|
||||
`SELECT output FROM scenario_run_steps WHERE runId = ${runId}`,
|
||||
`SELECT output FROM scenario_run_steps WHERE runId = '${runId}'`,
|
||||
);
|
||||
|
||||
expect(row[0].output).toBeNull();
|
||||
@@ -193,7 +192,7 @@ describe("ScenarioRunStepEntity.output + helpers.getStepOutput", () => {
|
||||
|
||||
const runId = await runScenario(scId);
|
||||
const rows = await dataSource.query(
|
||||
`SELECT "order", output FROM scenario_run_steps WHERE runId = ${runId} ORDER BY "order"`,
|
||||
`SELECT "order", output FROM scenario_run_steps WHERE runId = '${runId}' ORDER BY "order"`,
|
||||
);
|
||||
|
||||
expect(JSON.parse(rows[0].output as string)).toEqual([1, 2]);
|
||||
|
||||
@@ -21,24 +21,23 @@ describe("ScenarioController", () => {
|
||||
.post("/scenarios")
|
||||
.send({ name })
|
||||
.expect(201);
|
||||
return res.body as { id: number; name: string };
|
||||
return res.body as { id: string; name: string };
|
||||
}
|
||||
|
||||
async function createStep(
|
||||
scenarioId: number,
|
||||
scenarioId: string,
|
||||
overrides: Record<string, unknown> = {},
|
||||
) {
|
||||
const res = await request(app.getHttpServer())
|
||||
.post(`/scenarios/${scenarioId}/steps`)
|
||||
.send({
|
||||
order: 0,
|
||||
type: "exec",
|
||||
sessionName: "test-session",
|
||||
execCode: "return 1;",
|
||||
...overrides,
|
||||
})
|
||||
.expect(201);
|
||||
return res.body as { id: number };
|
||||
return res.body as { id: string };
|
||||
}
|
||||
|
||||
// ── POST /scenarios ────────────────────────────────────────────────────────
|
||||
@@ -142,7 +141,7 @@ describe("ScenarioController", () => {
|
||||
});
|
||||
|
||||
it("returns 404 for unknown id", async () => {
|
||||
await request(app.getHttpServer()).get("/scenarios/99999").expect(404);
|
||||
await request(app.getHttpServer()).get("/scenarios/00000000-0000-0000-0000-000000000001").expect(404);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -160,7 +159,7 @@ describe("ScenarioController", () => {
|
||||
|
||||
it("returns 404 for unknown id", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.patch("/scenarios/99999")
|
||||
.patch("/scenarios/00000000-0000-0000-0000-000000000001")
|
||||
.send({ name: "x" })
|
||||
.expect(404);
|
||||
});
|
||||
@@ -178,7 +177,7 @@ describe("ScenarioController", () => {
|
||||
});
|
||||
|
||||
it("returns 404 for unknown id", async () => {
|
||||
await request(app.getHttpServer()).delete("/scenarios/99999").expect(404);
|
||||
await request(app.getHttpServer()).delete("/scenarios/00000000-0000-0000-0000-000000000001").expect(404);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -191,7 +190,6 @@ describe("ScenarioController", () => {
|
||||
.post(`/scenarios/${sc.id}/steps`)
|
||||
.send({
|
||||
order: 0,
|
||||
type: "exec",
|
||||
sessionName: "my-session",
|
||||
execCode: "return 1;",
|
||||
})
|
||||
@@ -199,48 +197,50 @@ describe("ScenarioController", () => {
|
||||
|
||||
expect(res.body.id).toBeDefined();
|
||||
expect(res.body.order).toBe(0);
|
||||
expect(res.body.type).toBe("exec");
|
||||
expect(res.body.sessionName).toBe("my-session");
|
||||
});
|
||||
|
||||
it("creates a login step", async () => {
|
||||
it("creates a step without execCode", async () => {
|
||||
const sc = await createScenario();
|
||||
const res = await request(app.getHttpServer())
|
||||
.post(`/scenarios/${sc.id}/steps`)
|
||||
.send({ order: 0, type: "login", sessionName: "session-x" })
|
||||
.send({ order: 0, sessionName: "session-x" })
|
||||
.expect(201);
|
||||
|
||||
expect(res.body.type).toBe("login");
|
||||
expect(res.body.sessionName).toBe("session-x");
|
||||
expect(res.body.execCode).toBeNull();
|
||||
});
|
||||
|
||||
it("returns 400 when order is missing", async () => {
|
||||
const sc = await createScenario();
|
||||
await request(app.getHttpServer())
|
||||
.post(`/scenarios/${sc.id}/steps`)
|
||||
.send({ type: "exec", sessionName: "x" })
|
||||
.send({ sessionName: "x" })
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
it("returns 400 when type is invalid", async () => {
|
||||
it("ignores unknown fields in payload", async () => {
|
||||
const sc = await createScenario();
|
||||
await request(app.getHttpServer())
|
||||
const res = await request(app.getHttpServer())
|
||||
.post(`/scenarios/${sc.id}/steps`)
|
||||
.send({ order: 0, type: "unknown", sessionName: "x" })
|
||||
.expect(400);
|
||||
.expect(201);
|
||||
|
||||
expect(res.body).not.toHaveProperty("type");
|
||||
});
|
||||
|
||||
it("returns 400 when sessionName is missing", async () => {
|
||||
it("allows missing sessionName", async () => {
|
||||
const sc = await createScenario();
|
||||
await request(app.getHttpServer())
|
||||
.post(`/scenarios/${sc.id}/steps`)
|
||||
.send({ order: 0, type: "exec" })
|
||||
.expect(400);
|
||||
.send({ order: 0, execCode: "return 1;" })
|
||||
.expect(201);
|
||||
});
|
||||
|
||||
it("returns 404 for unknown scenario", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.post("/scenarios/99999/steps")
|
||||
.send({ order: 0, type: "exec", sessionName: "x" })
|
||||
.post("/scenarios/00000000-0000-0000-0000-000000000001/steps")
|
||||
.send({ order: 0, sessionName: "x" })
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
@@ -276,7 +276,7 @@ describe("ScenarioController", () => {
|
||||
it("returns 404 for unknown step", async () => {
|
||||
const sc = await createScenario();
|
||||
await request(app.getHttpServer())
|
||||
.get(`/scenarios/${sc.id}/steps/99999`)
|
||||
.get(`/scenarios/${sc.id}/steps/00000000-0000-0000-0000-000000000001`)
|
||||
.expect(404);
|
||||
});
|
||||
});
|
||||
@@ -300,7 +300,7 @@ describe("ScenarioController", () => {
|
||||
it("returns 404 for unknown step", async () => {
|
||||
const sc = await createScenario();
|
||||
await request(app.getHttpServer())
|
||||
.patch(`/scenarios/${sc.id}/steps/99999`)
|
||||
.patch(`/scenarios/${sc.id}/steps/00000000-0000-0000-0000-000000000001`)
|
||||
.send({ order: 1 })
|
||||
.expect(404);
|
||||
});
|
||||
@@ -350,7 +350,7 @@ describe("ScenarioController", () => {
|
||||
|
||||
it("returns 404 for unknown scenario", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.post("/scenarios/99999/run")
|
||||
.post("/scenarios/00000000-0000-0000-0000-000000000001/run")
|
||||
.expect(404);
|
||||
});
|
||||
});
|
||||
@@ -405,7 +405,7 @@ describe("ScenarioController", () => {
|
||||
|
||||
it("returns 404 for unknown scenario", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get("/scenarios/99999/runs")
|
||||
.get("/scenarios/00000000-0000-0000-0000-000000000001/runs")
|
||||
.expect(404);
|
||||
});
|
||||
});
|
||||
@@ -417,13 +417,11 @@ describe("ScenarioController", () => {
|
||||
const sc = await createScenario("export-me");
|
||||
await createStep(sc.id, {
|
||||
order: 0,
|
||||
type: "login",
|
||||
sessionName: "s",
|
||||
execCode: '{"keyId":"k","environmentName":"e"}',
|
||||
});
|
||||
await createStep(sc.id, {
|
||||
order: 1,
|
||||
type: "exec",
|
||||
sessionName: "s",
|
||||
execCode: "return 1;",
|
||||
validateCode: "return true;",
|
||||
@@ -484,7 +482,7 @@ describe("ScenarioController", () => {
|
||||
|
||||
it("returns 404 for unknown scenario", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get("/scenarios/99999/export")
|
||||
.get("/scenarios/00000000-0000-0000-0000-000000000001/export")
|
||||
.expect(404);
|
||||
});
|
||||
});
|
||||
@@ -498,21 +496,18 @@ describe("ScenarioController", () => {
|
||||
steps: [
|
||||
{
|
||||
order: 0,
|
||||
type: "login",
|
||||
sessionName: "s",
|
||||
execCode: '{"keyId":"k","environmentName":"e"}',
|
||||
validateCode: null,
|
||||
},
|
||||
{
|
||||
order: 1,
|
||||
type: "exec",
|
||||
sessionName: "s",
|
||||
execCode: "return 1;",
|
||||
validateCode: "return true;",
|
||||
},
|
||||
{
|
||||
order: 2,
|
||||
type: "sign",
|
||||
sessionName: "s",
|
||||
execCode: '{"keyId":"k"}',
|
||||
validateCode: null,
|
||||
@@ -528,12 +523,9 @@ describe("ScenarioController", () => {
|
||||
expect(res.body.id).toBeDefined();
|
||||
expect(res.body.name).toBe("imported scenario");
|
||||
expect(res.body.steps).toHaveLength(3);
|
||||
expect(res.body.steps[0].type).toBe("login");
|
||||
expect(res.body.steps[1].type).toBe("exec");
|
||||
expect(res.body.steps[2].type).toBe("sign");
|
||||
});
|
||||
|
||||
it("assigns a new id (does not collide with source)", async () => {
|
||||
it("preserves id when importing an exported scenario with id", async () => {
|
||||
const sc = await createScenario("original");
|
||||
const exportRes = await request(app.getHttpServer())
|
||||
.get(`/scenarios/${sc.id}/export`)
|
||||
@@ -544,14 +536,13 @@ describe("ScenarioController", () => {
|
||||
.send(exportRes.body)
|
||||
.expect(201);
|
||||
|
||||
expect(importRes.body.id).not.toBe(sc.id);
|
||||
expect(importRes.body.id).toBe(sc.id);
|
||||
});
|
||||
|
||||
it("round-trips a scenario faithfully", async () => {
|
||||
const sc = await createScenario("roundtrip");
|
||||
await createStep(sc.id, {
|
||||
order: 0,
|
||||
type: "exec",
|
||||
sessionName: "rs",
|
||||
execCode: "return 42;",
|
||||
validateCode: "return true;",
|
||||
@@ -600,14 +591,14 @@ describe("ScenarioController", () => {
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
it("returns 400 when a step has an invalid type", async () => {
|
||||
it("ignores unknown step fields during import", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.post("/scenarios/import")
|
||||
.send({
|
||||
name: "bad-type",
|
||||
steps: [{ order: 0, type: "unknown", sessionName: "s" }],
|
||||
})
|
||||
.expect(400);
|
||||
.expect(201);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -654,7 +645,7 @@ describe("ScenarioController", () => {
|
||||
it("returns 404 for unknown run", async () => {
|
||||
const sc = await createScenario();
|
||||
await request(app.getHttpServer())
|
||||
.get(`/scenarios/${sc.id}/run/99999`)
|
||||
.get(`/scenarios/${sc.id}/run/00000000-0000-0000-0000-000000000001`)
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
@@ -674,7 +665,9 @@ describe("ScenarioController", () => {
|
||||
|
||||
it("returns 404 for unknown scenario", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get("/scenarios/99999/run/1")
|
||||
.get(
|
||||
"/scenarios/00000000-0000-0000-0000-000000000001/run/00000000-0000-0000-0000-000000000001",
|
||||
)
|
||||
.expect(404);
|
||||
});
|
||||
});
|
||||
@@ -693,7 +686,7 @@ describe("ScenarioController", () => {
|
||||
// Manually mark run as pass so wait resolves immediately
|
||||
const dataSource = app.get(DataSource);
|
||||
await dataSource.query(
|
||||
`UPDATE scenario_runs SET status='pass' WHERE id=${runId}`,
|
||||
`UPDATE scenario_runs SET status='pass' WHERE id='${runId}'`,
|
||||
);
|
||||
|
||||
const res = await request(app.getHttpServer())
|
||||
@@ -716,7 +709,7 @@ describe("ScenarioController", () => {
|
||||
|
||||
const dataSource = app.get(DataSource);
|
||||
await dataSource.query(
|
||||
`UPDATE scenario_runs SET status='fail' WHERE id=${runId}`,
|
||||
`UPDATE scenario_runs SET status='fail' WHERE id='${runId}'`,
|
||||
);
|
||||
|
||||
const res = await request(app.getHttpServer())
|
||||
@@ -729,13 +722,15 @@ describe("ScenarioController", () => {
|
||||
it("returns 404 for unknown run", async () => {
|
||||
const sc = await createScenario();
|
||||
await request(app.getHttpServer())
|
||||
.post(`/scenarios/${sc.id}/run/99999/wait`)
|
||||
.post(`/scenarios/${sc.id}/run/00000000-0000-0000-0000-000000000001/wait`)
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it("returns 404 for unknown scenario", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.post("/scenarios/99999/run/1/wait")
|
||||
.post(
|
||||
"/scenarios/00000000-0000-0000-0000-000000000001/run/00000000-0000-0000-0000-000000000001/wait",
|
||||
)
|
||||
.expect(404);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -141,7 +141,7 @@ describe("SessionController", () => {
|
||||
});
|
||||
|
||||
it("returns 404 for unknown id", async () => {
|
||||
await request(app.getHttpServer()).delete("/sessions/99999").expect(404);
|
||||
await request(app.getHttpServer()).delete("/sessions/00000000-0000-0000-0000-000000000001").expect(404);
|
||||
});
|
||||
|
||||
it("returns 400 for non-numeric id", async () => {
|
||||
|
||||
Reference in New Issue
Block a user