From 20842a1e1d8ad17490523cac1653d8f110803176 Mon Sep 17 00:00:00 2001 From: Jacob Baker-Kretzmar Date: Sun, 15 Dec 2024 11:53:35 -0500 Subject: [PATCH] Build out additional integration tests --- tests/integration/forge.test.ts | 90 +++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 4 deletions(-) diff --git a/tests/integration/forge.test.ts b/tests/integration/forge.test.ts index e772193..2c3bebf 100644 --- a/tests/integration/forge.test.ts +++ b/tests/integration/forge.test.ts @@ -464,11 +464,93 @@ describe('sites', () => { expect(output3).toMatch(/sqlite \.+ \[\] OK/); }); - test.todo('add aliases'); + test('add aliases', async () => { + let name = `test-${id()}.laravel-deploy-preview.com`; + let alias = `test-alias-${id()}.laravel-deploy-preview.com`; + + let site = await Forge.createSite(server, { + name, + database: '', + aliases: [alias], + }); + + expect(site).toMatchObject({ + server_id: server, + name: name, + aliases: [alias], + status: 'installing', + }); + + await until( + () => site.status === 'installed', + async () => (site = await Forge.getSite(server, site.id)), + ); + + expect(site).toMatchObject({ + server_id: server, + name: name, + aliases: [alias], + status: 'installed', + }); + }); + + test('enable isolation', async () => { + let name = `test-${id()}.laravel-deploy-preview.com`; + let username = `test-user-${id()}`; + + let site = await Forge.createSite(server, { + name, + database: '', + isolated: true, + username, + }); + + expect(site).toMatchObject({ + server_id: server, + name: name, + username, + status: 'installing', + }); + + await until( + () => site.status === 'installed', + async () => (site = await Forge.getSite(server, site.id)), + ); - test.todo('enable isolation'); + expect(site).toMatchObject({ + server_id: server, + name: name, + username, + status: 'installed', + }); + }); - test.todo('set isolation username'); + test('set php version', async () => { + let name = `test-${id()}.laravel-deploy-preview.com`; + + let site = await Forge.createSite(server, { + name, + database: '', + php: 'php83', + }); - test.todo('set php version'); + expect(site).toMatchObject({ + server_id: server, + name: name, + php_version: 'php83', + status: 'installing', + }); + + await until( + () => site.status === 'installed', + async () => (site = await Forge.getSite(server, site.id)), + ); + + expect(site).toMatchObject({ + server_id: server, + name: name, + php_version: 'php83', + status: 'installed', + }); + }); });