fix(tests): apply user edits when creating test from template
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled

The form captured name/description/platform/procedure/tool edits but
never sent them — the created test always used the raw template values.

- TestTemplateInstantiate schema: add optional override fields
  (name, description, platform, procedure_text, tool_used)
- create_test_from_template service: accept *_override kwargs;
  use override value when provided, fall back to template value
- Router: pass all override fields from payload to service
- Frontend API createTestFromTemplate: accept overrides object, spread into body
- TestFromTemplateForm: pass all form state values as overrides

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
kitos
2026-05-28 16:38:40 +02:00
parent fa8e7f311b
commit b248c2816e
5 changed files with 45 additions and 8 deletions

View File

@@ -91,14 +91,22 @@ export async function createTest(payload: TestCreatePayload): Promise<Test> {
return data;
}
/** Create a test from an existing template. */
/** Create a test from an existing template, with optional field overrides. */
export async function createTestFromTemplate(
templateId: string,
techniqueId: string,
overrides?: {
name?: string;
description?: string;
platform?: string;
procedure_text?: string;
tool_used?: string;
},
): Promise<Test> {
const { data } = await client.post<Test>("/tests/from-template", {
template_id: templateId,
technique_id: techniqueId,
...overrides,
});
return data;
}