import { renderToStaticMarkup } from 'react-dom/server'; import { expect, it } from 'vitest'; import { ProxmoxDetails } from './proxmox'; const data = { node: 'pve', cluster: null, version: '9.2.2', not_backed_up: [101], guests: [ { vmid: 100, name: 'debian-guest', kind: 'qemu', status: 'running', template: false, cpus: 1, memory_bytes: 2 ** 30, disk_bytes: 2 ** 33, macs: ['bc:24:11:88:35:97'] }, { vmid: 101, name: 'alpine-ct', kind: 'lxc', status: 'running', template: false, cpus: 1, memory_bytes: 2 ** 27, disk_bytes: 2 ** 30, macs: [] }], backup_jobs: [{ id: 'backup-debian', enabled: true, schedule: '*/2:00', storage: 'local', selection: 'vmid', covered_vmids: [100], last_expected_run: 1795172400, next_run: 1795179600 }], backup_runs: [] }; it('lists guests, linked devices and an overall backup answer', () => { const view = renderToStaticMarkup(); expect(view).toContain('Alle geplanten Backups sind gelaufen.'); expect(view).toContain('href="#geraete/t/a/b"'); expect(view).toContain('Container'); expect(view).toMatch(/Ohne Backupjob<\/h3>

101 alpine-ct/); expect(view).toContain('Gelaufen'); }); it('names failed guests and explains a missing read token', () => { const failed = renderToStaticMarkup(); expect(failed).toContain('Nicht alle geplanten Backups sind gelaufen.'); expect(failed).toContain('100 debian-guest: Fehlgeschlagen'); expect(failed).toContain('nicht zugeordnet'); const missing = renderToStaticMarkup(); expect(missing).toContain('kein Lesezugang'); expect(renderToStaticMarkup()).toBe(''); });