Skip to content

Commit 8a2d7a2

Browse files
♻️ add test coverage for failed jobs (#111)
1 parent 61de7cf commit 8a2d7a2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/ClientTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ClientTest extends TestCase
2222
private string $oldKey;
2323
private string $fileTypesDir;
2424
private string $invoicePath;
25+
private string $failedJobPath;
2526

2627

2728
protected function setUp(): void
@@ -38,6 +39,9 @@ protected function setUp(): void
3839
$this->invoicePath = (
3940
getenv('GITHUB_WORKSPACE') ?: "."
4041
) . "/tests/resources/products/invoices/response_v4/complete.json";
42+
$this->failedJobPath = (
43+
getenv('GITHUB_WORKSPACE') ?: "."
44+
) . "/tests/resources/async/get_failed_job_error.json";
4145
}
4246

4347

@@ -140,5 +144,14 @@ public function testLoadLocalResponse()
140144
$localResponse = new LocalResponse($this->invoicePath);
141145
$res = $this->dummyClient->loadPrediction(InvoiceV4::class, $localResponse);
142146
$this->assertNotNull($res);
147+
$this->assertEquals(2, $res->document->nPages);
148+
}
149+
150+
public function testLoadFailedLocalResponse()
151+
{
152+
$localResponse = new LocalResponse($this->failedJobPath);
153+
$res = $this->dummyClient->loadPrediction(InvoiceV4::class, $localResponse);
154+
$this->assertNotNull($res);
155+
$this->assertEquals("failed", $res->job->status);
143156
}
144157
}

0 commit comments

Comments
 (0)