shared-utils.spec.ts 840 B

12345678910111213141516171819202122232425
  1. import { generateAllCombinations } from './shared-utils';
  2. describe('generateAllCombinations()', () => {
  3. it('works with an empty input array', () => {
  4. const result = generateAllCombinations([]);
  5. expect(result).toEqual([]);
  6. });
  7. it('works with an input of length 1', () => {
  8. const result = generateAllCombinations([['red', 'green', 'blue']]);
  9. expect(result).toEqual([['red'], ['green'], ['blue']]);
  10. });
  11. it('works with an input of length 2', () => {
  12. const result = generateAllCombinations([['red', 'green', 'blue'], ['small', 'large']]);
  13. expect(result).toEqual([
  14. ['red', 'small'],
  15. ['red', 'large'],
  16. ['green', 'small'],
  17. ['green', 'large'],
  18. ['blue', 'small'],
  19. ['blue', 'large'],
  20. ]);
  21. });
  22. });