1 import { processApiRequestsSafe } from '../../lib/api/helpers/safeApiRequests';
2 import { wait } from '../../lib/helpers/promise';
4 describe('safe api requests', () => {
5 it('it can process the full batch', async () => {
6 const generators = [1, 1].map((n, i) => {
12 const result = await processApiRequestsSafe(generators, 2, 100);
13 expect(result).toEqual([0, 1]);
16 it('it returns the result in order', async () => {
17 const generators = [2000, 500, 2, 300, 100, 1000].map((n, i) => {
23 const result = await processApiRequestsSafe(generators, 2, 100);
24 expect(result).toEqual([0, 1, 2, 3, 4, 5]);