shared-utils.spec.ts 902 B

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