mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
test(sites): assert static output stays inside the ssr build
The rendering tests added here pass on main, because the detector already matched both TanStack Start server entries; the output directory was the only thing wrong. So nothing in the branch failed before the fix. Assert the rule the two corrected entries broke instead: a framework's static adapter serves files from inside its ssr build output, because the pair describes one build. On main this fails on nuxt and tanstack-start, the two entries this branch corrects. Next.js is skipped, its static export genuinely leaves the ssr root. This replaces the literal directory assertions, which restated the config beside them. CollectionsTest is the precedent: load the config file, check a rule it cannot state about itself.
This commit is contained in:
1 parent
5be1b404b7
commit
c379f9194f
1 file changed
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Deployment;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class FrameworksTest extends TestCase
|
||||
{
|
||||
protected array $frameworks;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->frameworks = require('app/config/frameworks.php');
|
||||
}
|
||||
|
||||
public function testStaticOutputStaysInsideSsrOutput(): void
|
||||
{
|
||||
foreach ($this->frameworks as $key => $framework) {
|
||||
// Next.js exports a static site to its own root rather than into the ssr build.
|
||||
if ($key === 'nextjs') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ssr = $framework['adapters']['ssr']['outputDirectory'] ?? null;
|
||||
$static = $framework['adapters']['static']['outputDirectory'] ?? null;
|
||||
|
||||
if ($ssr === null || $static === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->assertStringStartsWith(
|
||||
\rtrim($ssr, '/') . '/',
|
||||
\rtrim($static, '/') . '/',
|
||||
"Framework '{$key}' serves static files from outside its ssr build output."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user