@@ -557,6 +557,37 @@ describe("qa-lab server", () => {
|
557 | 557 | expect(getResponse.headers.get("x-content-type-options")).toBe("nosniff"); |
558 | 558 | expect(await getResponse.text()).toBe("streamed body\n"); |
559 | 559 | |
| 560 | +const indexedArtifactUrl = new URL("/api/evidence/artifact", lab.baseUrl); |
| 561 | +indexedArtifactUrl.searchParams.set( |
| 562 | +"evidencePath", |
| 563 | +".artifacts/qa-e2e/server/qa-evidence.json", |
| 564 | +); |
| 565 | +indexedArtifactUrl.searchParams.set("entryIndex", "0"); |
| 566 | +indexedArtifactUrl.searchParams.set("artifactIndex", "0"); |
| 567 | +const indexedResponse = await fetchWithRetry(indexedArtifactUrl.toString()); |
| 568 | +expect(indexedResponse.status).toBe(200); |
| 569 | +expect(await indexedResponse.text()).toBe("streamed body\n"); |
| 570 | + |
| 571 | +const hexIndexUrl = new URL(indexedArtifactUrl); |
| 572 | +hexIndexUrl.searchParams.set("entryIndex", "0x0"); |
| 573 | +const hexIndexResponse = await fetchWithRetry(hexIndexUrl.toString()); |
| 574 | +expect(hexIndexResponse.status).toBe(400); |
| 575 | + |
| 576 | +const exponentIndexUrl = new URL(indexedArtifactUrl); |
| 577 | +exponentIndexUrl.searchParams.set("artifactIndex", "1e0"); |
| 578 | +const exponentIndexResponse = await fetchWithRetry(exponentIndexUrl.toString()); |
| 579 | +expect(exponentIndexResponse.status).toBe(400); |
| 580 | + |
| 581 | +const leadingZeroIndexUrl = new URL(indexedArtifactUrl); |
| 582 | +leadingZeroIndexUrl.searchParams.set("entryIndex", "00"); |
| 583 | +const leadingZeroIndexResponse = await fetchWithRetry(leadingZeroIndexUrl.toString()); |
| 584 | +expect(leadingZeroIndexResponse.status).toBe(400); |
| 585 | + |
| 586 | +const whitespaceIndexUrl = new URL(indexedArtifactUrl); |
| 587 | +whitespaceIndexUrl.searchParams.set("entryIndex", " 0 "); |
| 588 | +const whitespaceIndexResponse = await fetchWithRetry(whitespaceIndexUrl.toString()); |
| 589 | +expect(whitespaceIndexResponse.status).toBe(400); |
| 590 | + |
560 | 591 | await writeFile(path.join(evidenceDir, "undeclared.log"), "hidden\n", "utf8"); |
561 | 592 | const undeclaredUrl = new URL(artifactUrl); |
562 | 593 | undeclaredUrl.searchParams.set("artifactPath", "undeclared.log"); |
|