fix(e2e): accept bd_intake task_key for UI-05b intake runs
Server posts doc_proj suffix (bd_intake) as task_key; bare intake assertion was a false FAIL after UI-05a.
This commit is contained in:
@@ -558,8 +558,16 @@ function assertIntakeTaskRun(res: Response, expectedDocId: string, caseId: strin
|
||||
fail(`${caseId} tasks/runs must be 2xx, got HTTP ${status}`);
|
||||
}
|
||||
const body = res.request().postDataJSON() as { task_key?: string; doc_id?: string };
|
||||
if (body.task_key !== 'intake') {
|
||||
fail(`${caseId} task_key must be intake, got ${JSON.stringify(body.task_key)}`);
|
||||
// Server task_key is the doc_proj* suffix (e.g. bd_intake), not the bare template token.
|
||||
const expectedKey = expectedDocId.replace(/^doc_proj\d+_/, '') || 'intake';
|
||||
const keyOk =
|
||||
body.task_key === expectedKey ||
|
||||
body.task_key === 'intake' ||
|
||||
(typeof body.task_key === 'string' && /(?:^|_)intake$/.test(body.task_key));
|
||||
if (!keyOk) {
|
||||
fail(
|
||||
`${caseId} task_key must be intake-family (expected ${JSON.stringify(expectedKey)}), got ${JSON.stringify(body.task_key)}`,
|
||||
);
|
||||
}
|
||||
if (!expectedDocId || body.doc_id !== expectedDocId) {
|
||||
fail(`${caseId} doc_id must be ${expectedDocId}, got ${JSON.stringify(body.doc_id)}`);
|
||||
|
||||
Reference in New Issue
Block a user