feat: Lightsail + svg animation

This commit is contained in:
Zakaria
2026-10-11 14:19:00 -04:00
parent 0036ef7e51
commit ca1e845cb6
40 changed files with 1887 additions and 34 deletions
@@ -0,0 +1,42 @@
import {afterEach, describe, expect, mock, test} from 'bun:test'
import {deployLightsailNodeApplication, deployLightsailStaticFiles} from './lightsailDeployment'
const originalEndpoint = process.env.FLOCI_ENDPOINT
const originalFetch = globalThis.fetch
afterEach(() => {
process.env.FLOCI_ENDPOINT = originalEndpoint
globalThis.fetch = originalFetch
mock.restore()
})
describe('deployLightsailNodeApplication', () => {
test('forwards package uploads and preserves core deployment diagnostics', async () => {
process.env.FLOCI_ENDPOINT = 'http://core.test:4566'
const fetch = mock(() => Promise.resolve(new Response(JSON.stringify({status: 'deployed', files: 2, port: 3000, releaseId: 'release'}), {headers: {'content-type': 'application/json'}})))
globalThis.fetch = fetch as unknown as typeof globalThis.fetch
const form = new FormData()
form.append('files', new File(['{}'], 'package.json'))
form.append('port', '3000')
await expect(deployLightsailNodeApplication('node app', form)).resolves.toEqual({status: 'deployed', files: 2, port: 3000, releaseId: 'release'})
expect(fetch).toHaveBeenCalledWith('http://core.test:4566/_floci/diagnostics/lightsail/instances/node%20app/node-application', expect.objectContaining({
method: 'POST', body: form, redirect: 'error',
}))
})
})
describe('deployLightsailStaticFiles', () => {
test('forwards multipart files only to the diagnostics deployment endpoint', async () => {
process.env.FLOCI_ENDPOINT = 'http://core.test:4566'
const fetch = mock(() => Promise.resolve(new Response(JSON.stringify({status: 'deployed', files: 1}), {headers: {'content-type': 'application/json'}})))
globalThis.fetch = fetch as unknown as typeof globalThis.fetch
const form = new FormData()
form.append('files', new File(['<h1>ok</h1>'], 'site/index.html'))
await expect(deployLightsailStaticFiles('web site', form)).resolves.toEqual({status: 'deployed', files: 1})
expect(fetch).toHaveBeenCalledWith('http://core.test:4566/_floci/diagnostics/lightsail/instances/web%20site/static-files', expect.objectContaining({
method: 'POST', body: form, redirect: 'error',
}))
})
})