|
| 1 | +const organizeChristmasDinner = require('./index'); |
| 2 | + |
| 3 | +describe('23 => La comida de navidad', () => { |
| 4 | + const testCases = [ |
| 5 | + { |
| 6 | + input: [ |
| 7 | + ['christmas turkey', 'turkey', 'sauce', 'herbs'], |
| 8 | + ['cake', 'flour', 'sugar', 'egg'], |
| 9 | + ['hot chocolate', 'chocolate', 'milk', 'sugar'], |
| 10 | + ['pizza', 'sauce', 'tomato', 'cheese', 'ham'], |
| 11 | + ], |
| 12 | + output: [ |
| 13 | + ['sauce', 'christmas turkey', 'pizza'], |
| 14 | + ['sugar', 'cake', 'hot chocolate'], |
| 15 | + ], |
| 16 | + }, |
| 17 | + { |
| 18 | + input: [ |
| 19 | + ['fruit salad', 'apple', 'banana', 'orange'], |
| 20 | + ['berry smoothie', 'blueberry', 'banana', 'milk'], |
| 21 | + ['apple pie', 'apple', 'sugar', 'flour'], |
| 22 | + ], |
| 23 | + output: [ |
| 24 | + ['apple', 'apple pie', 'fruit salad'], |
| 25 | + ['banana', 'berry smoothie', 'fruit salad'], |
| 26 | + ], |
| 27 | + }, |
| 28 | + { |
| 29 | + input: [ |
| 30 | + ['gingerbread', 'flour', 'ginger', 'sugar'], |
| 31 | + ['glazed ham', 'ham', 'honey', 'sugar', 'vinegar'], |
| 32 | + ['roast chicken', 'chicken', 'rosemary', 'thyme', 'garlic'], |
| 33 | + ['vegetable soup', 'carrot', 'potato', 'onion', 'garlic'], |
| 34 | + ['fruit punch', 'apple juice', 'orange juice', 'sugar'], |
| 35 | + ], |
| 36 | + output: [ |
| 37 | + ['garlic', 'roast chicken', 'vegetable soup'], |
| 38 | + ['sugar', 'fruit punch', 'gingerbread', 'glazed ham'], |
| 39 | + ], |
| 40 | + }, |
| 41 | + { |
| 42 | + input: [ |
| 43 | + ['pumpkin pie', 'pumpkin', 'cinnamon', 'sugar', 'flour'], |
| 44 | + ['mashed potatoes', 'potatoes', 'butter', 'milk'], |
| 45 | + ['cinnamon rolls', 'flour', 'cinnamon', 'butter', 'sugar'], |
| 46 | + ['turkey stuffing', 'bread crumbs', 'celery', 'onion', 'butter'], |
| 47 | + ], |
| 48 | + output: [ |
| 49 | + ['butter', 'cinnamon rolls', 'mashed potatoes', 'turkey stuffing'], |
| 50 | + ['cinnamon', 'cinnamon rolls', 'pumpkin pie'], |
| 51 | + ['flour', 'cinnamon rolls', 'pumpkin pie'], |
| 52 | + ['sugar', 'cinnamon rolls', 'pumpkin pie'], |
| 53 | + ], |
| 54 | + }, |
| 55 | + { |
| 56 | + input: [ |
| 57 | + ['chicken alfredo', 'chicken', 'pasta', 'parmesan'], |
| 58 | + ['parmesan chicken', 'chicken', 'parmesan', 'bread crumbs'], |
| 59 | + ['pasta salad', 'pasta', 'olive oil', 'tomato'], |
| 60 | + ['tomato soup', 'tomato', 'basil', 'cream'], |
| 61 | + ], |
| 62 | + output: [ |
| 63 | + ['chicken', 'chicken alfredo', 'parmesan chicken'], |
| 64 | + ['parmesan', 'chicken alfredo', 'parmesan chicken'], |
| 65 | + ['pasta', 'chicken alfredo', 'pasta salad'], |
| 66 | + ['tomato', 'pasta salad', 'tomato soup'], |
| 67 | + ], |
| 68 | + }, |
| 69 | + { |
| 70 | + input: [ |
| 71 | + ['snowflake cookies', 'flour', 'sugar', 'vanilla'], |
| 72 | + ['winter stew', 'beef', 'carrots', 'potatoes'], |
| 73 | + ['holiday punch', 'cranberry juice', 'orange juice', 'sparkling water'], |
| 74 | + ['festive salad', 'lettuce', 'cranberries', 'walnuts'], |
| 75 | + ], |
| 76 | + output: [], |
| 77 | + }, |
| 78 | + ]; |
| 79 | + |
| 80 | + it('should return an array type', () => { |
| 81 | + expect(Array.isArray(organizeChristmasDinner(testCases[0].input))).toBe(true); |
| 82 | + }); |
| 83 | + |
| 84 | + it.each(testCases)('should return the correct output', ({ input, output }) => { |
| 85 | + expect(organizeChristmasDinner(input)).toEqual(output); |
| 86 | + }); |
| 87 | +}); |
0 commit comments