WIP: Add test for empty source

This commit is contained in:
Khushboo Verma
2025-03-18 13:04:44 +05:30
parent 313a6b0f7e
commit 20e3597a27
@@ -2243,4 +2243,40 @@ class SitesCustomServerTest extends Scope
$this->cleanupSite($siteId);
}
public function testEmptySiteSource(): void
{
$siteId = $this->setupSite([
'siteId' => ID::unique(),
'name' => 'Empty source site',
'framework' => 'other',
'buildRuntime' => 'node-22',
'outputDirectory' => './',
]);
$this->assertNotEmpty($siteId);
$site = $this->getSite($siteId);
$this->assertEquals('200', $site['headers']['status-code']);
$this->assertArrayHasKey('adapter', $site['body']);
$this->assertEmpty($site['body']['adapter']);
$domain = $this->setupSiteDomain($siteId);
$this->assertNotEmpty($domain);
$deploymentId = $this->setupDeployment($siteId, [
'code' => $this->packageSite('empty'),
'activate' => 'true'
]);
$this->assertNotEmpty($deploymentId);
$site = $this->getSite($siteId);
$this->assertEquals('200', $site['headers']['status-code']);
$proxyClient = new Client();
$proxyClient->setEndpoint('http://' . $domain);
$response = $proxyClient->call(Client::METHOD_GET, '/');
$this->assertEquals(200, $response['headers']['status-code']);
$this->cleanupSite($siteId);
}
}