import { expect, it } from 'vitest'; import { render } from 'svelte/server'; import LaunchRecipe from '../../src/lib/ui/components/LaunchRecipe.svelte'; import type { LaunchFileSummary, LaunchRecipeSummary } from '../../src/lib/deployment-plan.js'; const file = (overrides: Partial): LaunchFileSummary => ({ name: 'Script', kind: 'script', path: 'script.gsc', versionId: 20, version: 11, sha256: 'a'.repeat(64), size: 1200, ...overrides }); const recipe: LaunchRecipeSummary = { game: 't5', mapSlug: 'theater', mapName: 'Kino der Toten', expectedMap: 'zombie_theater', capturedAt: '2026-10-17T12:00:00Z', image: 'runtime:latest', configFile: 'dedicated_sp.cfg', configSource: 'Production', fingerprint: 'b'.repeat(64), files: [ file({ releaseVersion: '1.2.3' }), file({ kind: 'plugin', releaseVersion: 'v3.1.0' }), file({ version: 2 }), file({ kind: 'config', version: 3 }), file({ kind: 'config', versionId: null, version: null }) ] }; it.each([false, true])( 'shows release versions and preserves legacy/generated labels in historical=%s launch files', (historical) => { const body = render(LaunchRecipe, { props: { recipe, historical } }).body.replace( /\s+/g, ' ' ); expect(body).toContain('1.2.3 (upload 11) · script'); expect(body).toContain('v3.1.0 (upload 11) · plugin'); expect(body).toContain('Unversioned (upload 2) · script'); expect(body).toContain('v3 · config'); expect(body).toContain('Generated · config'); expect(body).not.toContain('v11 ·'); expect(body).not.toContain('v2 ·'); } );