test: stage the legal files in the launcher archive fixture

build-server-archive.mjs now requires LICENSE and THIRD_PARTY_NOTICES.md,
so the installer fixture stages both and checks that they land next to
service.js. The sidecar half of the legal route test gets the 60 s hook
timeout the other full-server suites use.
This commit is contained in:
shumeiko.it
2026-11-04 10:47:15 +01:00
parent fc9ab861ee
commit d3a39fe3cf
2 changed files with 6 additions and 1 deletions

View File

@@ -168,6 +168,8 @@ describe.skipIf(!target)('install, update and uninstall from a packed archive',
fs.writeFileSync(path.join(resources, process.platform === 'win32' ? 'node.exe' : 'node'), 'not a real runtime'); fs.writeFileSync(path.join(resources, process.platform === 'win32' ? 'node.exe' : 'node'), 'not a real runtime');
fs.writeFileSync(path.join(resources, 'service.js'), 'console.log("service");\n'); fs.writeFileSync(path.join(resources, 'service.js'), 'console.log("service");\n');
fs.writeFileSync(path.join(resources, 'service.js.map'), '{}'); fs.writeFileSync(path.join(resources, 'service.js.map'), '{}');
fs.writeFileSync(path.join(resources, 'LICENSE'), 'MIT License\n');
fs.writeFileSync(path.join(resources, 'THIRD_PARTY_NOTICES.md'), '# Third-party notices\n');
fs.writeFileSync(path.join(web, 'index.html'), '<!doctype html>'); fs.writeFileSync(path.join(web, 'index.html'), '<!doctype html>');
const out = path.join(work, 'out'); const out = path.join(work, 'out');
const result = spawnSync( const result = spawnSync(
@@ -203,6 +205,9 @@ describe.skipIf(!target)('install, update and uninstall from a packed archive',
expect(fs.readFileSync(path.join(layout.appDir, 'service.js'), 'utf8')).toContain('service'); expect(fs.readFileSync(path.join(layout.appDir, 'service.js'), 'utf8')).toContain('service');
expect(fs.existsSync(path.join(layout.appDir, 'web', 'index.html'))).toBe(true); expect(fs.existsSync(path.join(layout.appDir, 'web', 'index.html'))).toBe(true);
expect(fs.existsSync(path.join(layout.appDir, 'service.js.map'))).toBe(false); expect(fs.existsSync(path.join(layout.appDir, 'service.js.map'))).toBe(false);
// UF-059: the license and the notices are installed next to service.js.
expect(fs.readFileSync(path.join(layout.appDir, 'THIRD_PARTY_NOTICES.md'), 'utf8')).toContain('Third-party notices');
expect(fs.existsSync(path.join(layout.appDir, 'LICENSE'))).toBe(true);
expect(fs.readFileSync(layout.launcherFile, 'utf8')).toBe('// bundled tool\n'); expect(fs.readFileSync(layout.launcherFile, 'utf8')).toBe('// bundled tool\n');
const record = readRecord(layout); const record = readRecord(layout);
expect(record).toMatchObject({ version: VERSION, target, source: archive }); expect(record).toMatchObject({ version: VERSION, target, source: archive });

View File

@@ -95,7 +95,7 @@ describe('legal routes in the sidecar', () => {
vi.stubEnv('WAGGLE_TRUST_LOCALHOST', '0'); vi.stubEnv('WAGGLE_TRUST_LOCALHOST', '0');
dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-legal-server-')); dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-legal-server-'));
server = await buildLocalServer({ dataDir }); server = await buildLocalServer({ dataDir });
}); }, 60_000);
afterAll(async () => { afterAll(async () => {
await server.close(); await server.close();