fix(scenarios): preselect default environment when opening run modal

- choose the scenario's default environment when the run modal opens on
  the scenario detail page, instead of in a load effect that raced with
  loading the scenario and could fall back to the first environment
- set the run to a final status directly in the status filter test so
  the scheduler can't change it mid-test
- bump version to 1.19.2
This commit is contained in:
ars9 committed 2026-09-30 21:07:15 +03:00
1 parent 68415f805b
commit e586ab9bd9
5 files changed
+47 -39

No files matched your search

+18 -13
View File
@@ -550,22 +550,27 @@ describe("ScenarioController", () => {
it("filters by status", async () => {
const sc = await createScenario();
await createStep(sc.id, { order: 0 });
await createRun(sc.id);
const run = await createRun(sc.id);
// Put the run in a final state directly: a pending run would be picked
// up by the scheduler (@Interval) and could change status mid-test
await app
.get(DataSource)
.query(`UPDATE scenario_runs SET status = 'fail' WHERE id = ?`, [
run.id,
]);
const pendingRes = await request(app.getHttpServer())
.get(`/scenarios/${sc.id}/runs?status=pending`)
const failRes = await request(app.getHttpServer())
.get(`/scenarios/${sc.id}/runs?status=fail`)
.expect(200);
expect(failRes.body.total).toBe(1);
expect(failRes.body.data[0].id).toBe(run.id);
expect(pendingRes.body.total).toBeGreaterThanOrEqual(1);
pendingRes.body.data.forEach((r: { status: string }) =>
expect(r.status).toBe("pending"),
);
const passRes = await request(app.getHttpServer())
.get(`/scenarios/${sc.id}/runs?status=pass`)
.expect(200);
expect(passRes.body.total).toBe(0);
for (const status of ["pending", "pass"]) {
const res = await request(app.getHttpServer())
.get(`/scenarios/${sc.id}/runs?status=${status}`)
.expect(200);
expect(res.body.total).toBe(0);
}
});
it("returns 400 for invalid status filter", async () => {