Files

27 lines
1.0 KiB
JavaScript

import { describe, expect, it } from 'vitest';
import * as google from './google/index.js';
import { fetchQuotaForProvider, listConfiguredQuotaProviders } from './index.js';
describe('quota provider registry', () => {
it('exposes google provider configuration helpers through the provider module', () => {
expect(google.providerId).toBe('google');
expect(google.providerName).toBe('Google');
expect(typeof google.isConfigured).toBe('function');
expect(typeof google.resolveGoogleAuthSources).toBe('function');
});
it('can list configured providers without missing provider exports', () => {
expect(() => listConfiguredQuotaProviders()).not.toThrow();
});
it('coalesces concurrent refreshes by provider ID', async () => {
const first = fetchQuotaForProvider('unsupported-test-provider');
const second = fetchQuotaForProvider('unsupported-test-provider');
expect(first).toBe(second);
await first;
expect(fetchQuotaForProvider('unsupported-test-provider')).not.toBe(first);
});
});