Skip to content

Commit f289c8c

Browse files
mvanhornclaude
andcommitted
fix(test): wait for task completion before fetching documents
The testGetTaskDocumentsClient test was calling getTaskDocuments on a task that hadn't completed yet, causing a JsonException when trying to parse the NDJSON response. Wait for the task to finish first. Also removes the redundant assertNotEmpty($documents) that phpstan flagged as alreadyNarrowedType since the array is guaranteed non-empty by the assertNotEmpty($lines) above. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 81d91b5 commit f289c8c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/Endpoints/TasksTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function testGetTaskDocumentsClient(): void
5555
$http->patch('/experimental-features', ['getTaskDocumentsRoute' => true]);
5656

5757
$task = $this->index->updateDocuments(self::DOCUMENTS);
58+
$task->wait();
5859

5960
$stream = $this->client->getTaskDocuments($task->getTaskUid());
6061

@@ -63,7 +64,6 @@ public function testGetTaskDocumentsClient(): void
6364
self::assertNotEmpty($lines, 'Stream should contain at least one NDJSON line');
6465

6566
$documents = array_map(fn (string $line) => json_decode($line, true, 512, \JSON_THROW_ON_ERROR), $lines);
66-
self::assertNotEmpty($documents);
6767
self::assertArrayHasKey('id', $documents[0], 'Each document should have an id field');
6868
}
6969

0 commit comments

Comments
 (0)