Files
netris-nestri/apps/api/test/download.test.ts
T
Wanjohi 84bd6b899a feat(install): the desktop app downloads from a link that never changes
/download/windows and /download/linux redirect to a one-minute signed URL
for the current desktop app, from the same private bucket as the host
agent, so a download page can link to them once and every download still
passes through the API. Which version they hand out is a constant bumped
by a commit after a release is published, as the host installer's is.

/desktop.sh installs it on Linux for the calling user: one binary in
~/.local/bin and a launcher entry, no root.
2026-10-11 14:13:44 +03:00

23 lines
813 B
TypeScript

import { describe, expect, test } from 'bun:test';
import { app } from '../app/index';
describe('the desktop app download', () => {
test('the Linux installer is served as a script', async () => {
const res = await app.request('/desktop.sh');
expect(res.status).toBe(200);
expect(res.headers.get('content-type')).toContain('shellscript');
expect(await res.text()).toContain('/download/linux');
});
test('a platform that is not offered is not found', async () => {
expect((await app.request('/download/macos')).status).toBe(404);
});
test('a desktop asset is a known component', async () => {
// No bucket in tests: the route got past its allow-list to the config check.
const res = await app.request('/install/desktop/0.1.0/Nestri.exe');
expect([302, 503]).toContain(res.status);
});
});