import { RateLimiter } from '../rate-limiter/index.js'; import { HostexApiClient } from '../client/index.js'; describe('HostexApiClient rate limiter integration', () => { it('accepts a RateLimiterConfig and creates a RateLimiter internally', () => { // Should not throw — RateLimiter is created lazily from config const client = new HostexApiClient({ accessToken: 'test-token', rateLimiter: { redis: { url: 'https://fake.upstash.io', token: 'fake-token' }, hostId: 'test-host', }, }); expect(client).toBeDefined(); }); it('accepts a pre-built RateLimiter instance', () => { const limiter = new RateLimiter({ redis: { url: 'https://fake.upstash.io', token: 'fake-token' }, hostId: 'test-host', }); const client = new HostexApiClient({ accessToken: 'test-token', rateLimiter: limiter, }); expect(client).toBeDefined(); }); it('works without rate limiter configured', () => { const client = new HostexApiClient({ accessToken: 'test-token', }); expect(client).toBeDefined(); }); });