/** * Tests for the adapter factory function. */ import { createMeshCentralAdapter } from '../adapter'; describe('createMeshCentralAdapter', () => { it('should return mock adapter by default', () => { const adapter = createMeshCentralAdapter(); expect(adapter.name).toBe('mock'); }); it('should return mock adapter when adapterType is mock', () => { const adapter = createMeshCentralAdapter({ adapterType: 'mock' }); expect(adapter.name).toBe('mock'); }); it('should allow real adapter construction before protected credentials are injected', () => { const adapter = createMeshCentralAdapter({ adapterType: 'real', meshCentralUrl: 'http://test:8080' }); expect(adapter.name).toBe('meshcentral-real'); }); it('should accept custom configuration', () => { const config = { meshCentralUrl: 'http://custom-url:8080', timeoutMs: 5_000, maxOutputLength: 32_768, }; const adapter = createMeshCentralAdapter(config); expect(adapter.name).toBe('mock'); // Verify mock adapter receives config (would be used by real adapter) expect(adapter).toBeDefined(); }); });