orderUniqueFirst.test.ts

import { firstItemsFirst } from './orderUniqueFirst';

describe('test orderUniqueFirst function: firstItemsFirst', () => {
  it('should return first items first', () => {
    const inputMap = new Map();
    inputMap.set('item-one', ['a', 'b', 'c', 'd']);
    inputMap.set('item-two', ['m', 'n', 'o', 'p']);
    inputMap.set('item-three', ['x', 'y', 'z']);
    inputMap.set('item-four', ['4']);
    const expectedArray = ['a', 'm', 'x', '4', 'b', 'n', 'y', 'c', 'o', 'z', 'd', 'p'];
    expect(firstItemsFirst(inputMap)).toEqual(expectedArray);
  });
});