refactor(scenario): remove validateCode — assertions live in execCode
- drop validateCode column, DTOs, service mappings, and scheduler branch - remove parseValidateResult helper and ValidateResult interface - inject playwright expect into code executor for direct use in execCode - strip validateCode from MCP tool schemas, client types, and UI forms
This commit is contained in:
@@ -477,7 +477,6 @@ describe("ScenarioController", () => {
|
||||
order: 1,
|
||||
sessionName: "s",
|
||||
execCode: "return 1;",
|
||||
validateCode: "return true;",
|
||||
});
|
||||
|
||||
const res = await request(app.getHttpServer())
|
||||
@@ -536,25 +535,6 @@ describe("ScenarioController", () => {
|
||||
expect(step).not.toHaveProperty("updatedAt");
|
||||
});
|
||||
|
||||
it("exports null validateCode as null", async () => {
|
||||
const sc = await createScenario("export-null-validate");
|
||||
await createStep(sc.id, {
|
||||
order: 0,
|
||||
sessionName: "s",
|
||||
execCode: "return 1;",
|
||||
});
|
||||
|
||||
const res = await request(app.getHttpServer())
|
||||
.get(`/scenarios/${sc.id}/export`)
|
||||
.expect(200);
|
||||
|
||||
const exported = yamlParse(res.text) as {
|
||||
steps: Array<{ validateCode: string | null }>;
|
||||
};
|
||||
|
||||
expect(exported.steps[0].validateCode).toBeNull();
|
||||
});
|
||||
|
||||
it("returns 404 for unknown scenario", async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get("/scenarios/00000000-0000-0000-0000-000000000001/export")
|
||||
@@ -572,17 +552,14 @@ describe("ScenarioController", () => {
|
||||
{
|
||||
sessionName: "s",
|
||||
execCode: '{"keyId":"k","environmentName":"e"}',
|
||||
validateCode: null,
|
||||
},
|
||||
{
|
||||
sessionName: "s",
|
||||
execCode: "return 1;",
|
||||
validateCode: "return true;",
|
||||
},
|
||||
{
|
||||
sessionName: "s",
|
||||
execCode: '{"keyId":"k"}',
|
||||
validateCode: null,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -622,7 +599,6 @@ describe("ScenarioController", () => {
|
||||
order: 0,
|
||||
sessionName: "rs",
|
||||
execCode: "return 42;",
|
||||
validateCode: "return true;",
|
||||
});
|
||||
|
||||
const exportRes = await request(app.getHttpServer())
|
||||
@@ -630,7 +606,7 @@ describe("ScenarioController", () => {
|
||||
.expect(200);
|
||||
|
||||
const exported = yamlParse(exportRes.text) as {
|
||||
steps: Array<{ execCode: string; validateCode: string | null }>;
|
||||
steps: Array<{ execCode: string }>;
|
||||
};
|
||||
|
||||
const importRes = await request(app.getHttpServer())
|
||||
@@ -643,9 +619,6 @@ describe("ScenarioController", () => {
|
||||
expect(importRes.body.steps[0].execCode).toBe(
|
||||
exported.steps[0].execCode,
|
||||
);
|
||||
expect(importRes.body.steps[0].validateCode).toBe(
|
||||
exported.steps[0].validateCode,
|
||||
);
|
||||
});
|
||||
|
||||
it("imports with empty steps array", async () => {
|
||||
|
||||
Reference in New Issue
Block a user