import { describe, expect, it } from 'vitest'; import { validateInventory } from '../../src/lib/server/hosts/index.js'; const update = { enabled: true, state: 'updated', currentVersion: '1.2.0', targetVersion: '1.2.0', checkedAt: '2026-10-04T12:00:00Z' }; describe('agent update inventory', () => { it('accepts legacy inventory and only publishes recognized update display fields', () => { expect(validateInventory({ protocolVersion: 1 })).toEqual({ protocolVersion: 1 }); expect(validateInventory({ agentUpdate: { ...update, credential: 'private', journal: { backups: 'local-path' } } }).agentUpdate).toEqual(update); }); it.each([null, [], 'updated', { ...update, enabled: 'yes' }, { ...update, state: '