import { expect, tap } from '@git.zone/tstest/tapbundle'; import { createApcupsdDiscoveryDescriptor } from '../../ts/integrations/apcupsd/index.js'; tap.test('matches and validates manual APCUPSd entries', async () => { const descriptor = createApcupsdDiscoveryDescriptor(); const matcher = descriptor.getMatchers()[0]; const result = await matcher.matches({ host: '192.168.1.60', name: 'Rack APC UPS' }, {}); expect(result.matched).toBeTrue(); expect(result.candidate?.integrationDomain).toEqual('apcupsd'); expect(result.candidate?.port).toEqual(3551); const validator = descriptor.getValidators()[0]; const validation = await validator.validate(result.candidate!, {}); expect(validation.matched).toBeTrue(); expect(validation.normalizedDeviceId).toEqual('192.168.1.60:3551'); }); tap.test('rejects manual entries without APCUPSd hints', async () => { const descriptor = createApcupsdDiscoveryDescriptor(); const matcher = descriptor.getMatchers()[0]; const result = await matcher.matches({ name: 'Generic device' }, {}); expect(result.matched).toBeFalse(); }); export default tap.start();