File size: 478 Bytes
90cbf22
 
 
 
 
 
 
 
 
 
 
 
 
 
8cbe088
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { asyncMap } from './asyncMap';

describe('asyncMap', () => {
  it('should map over a list asynchronously', async () => {
    const list = [1, 2, 3];
    const result = await asyncMap(list, async (item: number) => item * 2);
    expect(result).toEqual([2, 4, 6]);
  });

  it('should handle empty list input', async () => {
    const list: number[] = [];
    const result = await asyncMap(list, async (item: number) => item * 2);
    expect(result).toEqual([]);
  });
});