Skip to content

Commit 4e8d2e8

Browse files
simonhampclaude
andcommitted
Fake Torchlight in docs prerelease tests to fix CI
The prerelease docs tests render pages containing fenced code blocks. Torchlight throws when no token is configured (as in CI), and because the CommonMark converter is a shared static singleton, that failure cascaded into unrelated tests (heading renderer, docs meta, support tickets). Configure a fake token and fake the Torchlight API in setUp, matching TorchlightCodeBlockTest, so the pages render offline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 98c4339 commit 4e8d2e8

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/Feature/DocsPrereleaseVersionTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,27 @@
44

55
use App\Services\DocsVersionService;
66
use Illuminate\Foundation\Testing\RefreshDatabase;
7+
use Illuminate\Support\Facades\Http;
78
use Tests\TestCase;
89

910
class DocsPrereleaseVersionTest extends TestCase
1011
{
1112
use RefreshDatabase;
1213

14+
protected function setUp(): void
15+
{
16+
parent::setUp();
17+
18+
// These tests render full docs pages that contain fenced code blocks.
19+
// Torchlight throws outside production when no token is configured (as
20+
// in CI), so give it a token and fake the API to force its offline
21+
// fallback — the pages render deterministically without a real token.
22+
config(['torchlight.token' => 'test-token']);
23+
Http::fake([
24+
'*' => Http::response(['blocks' => []], 200),
25+
]);
26+
}
27+
1328
public function test_prerelease_pages_show_the_beta_notice(): void
1429
{
1530
$response = $this->get('/docs/mobile/4/edge-components/button');

0 commit comments

Comments
 (0)