fix(quota): coalesce provider usage refreshes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import * as google from './google/index.js';
|
||||
import { listConfiguredQuotaProviders } from './index.js';
|
||||
import { fetchQuotaForProvider, listConfiguredQuotaProviders } from './index.js';
|
||||
|
||||
describe('quota provider registry', () => {
|
||||
it('exposes google provider configuration helpers through the provider module', () => {
|
||||
@@ -14,4 +14,13 @@ describe('quota provider registry', () => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user