From 27d641de158a93a205ea63d85b6659e434ce764d Mon Sep 17 00:00:00 2001 From: eslopfer Date: Thu, 29 Dec 2022 18:50:57 +0000 Subject: [PATCH 1/5] chore(level-up): modify subject description and tests to remove references to alcohol --- js/tests/level-up.json | 10 +++++----- subjects/level-up/README.md | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/js/tests/level-up.json b/js/tests/level-up.json index cb5618cc9f..636b271f13 100644 --- a/js/tests/level-up.json +++ b/js/tests/level-up.json @@ -8,16 +8,16 @@ "code": "equal(shaker.length, 3)" }, { - "description": "shaker can make a cocktail.", - "code": "equal(shaker(1, 'strawberry', true), '1 strawberry cocktail')" + "description": "shaker can make a skinny milkshake.", + "code": "equal(shaker(1, 'strawberry', true), '1 skinny strawberry milkshake')" }, { "description": "shaker can make a milkshake.", "code": "equal(shaker(1, 'strawberry', false), '1 strawberry milkshake')" }, { - "description": "shaker can make multiple cocktails.", - "code": "equal(shaker(7, 'banana', true), '7 banana cocktails')" + "description": "shaker can make multiple skinny milkshakes.", + "code": "equal(shaker(7, 'banana', true), '7 skinny banana milkshakes')" }, { "description": "shaker can make multiple milkshakes.", @@ -25,6 +25,6 @@ }, { "description": "shaker is shakin it right.", - "code": "equal(shaker(1, 'vanilla', true), '1 vanilla cocktail')\nequal(shaker(1, 'mango', true), '1 mango cocktail')\nequal(shaker(2, 'banana', true), '2 banana cocktails')\nequal(shaker(2, 'chocolate', false), '2 chocolate milkshakes')\nequal(shaker(2, 'vanilla', false), '2 vanilla milkshakes')\nequal(shaker(2, 'strawberry', false), '2 strawberry milkshakes')" + "code": "equal(shaker(1, 'vanilla', true), '1 skinny vanilla milkshake')\nequal(shaker(1, 'mango', true), '1 skinny mango milkshake')\nequal(shaker(2, 'banana', true), '2 skinny banana milkshakes')\nequal(shaker(2, 'chocolate', false), '2 chocolate milkshakes')\nequal(shaker(2, 'vanilla', false), '2 vanilla milkshakes')\nequal(shaker(2, 'strawberry', false), '2 strawberry milkshakes')" } ] \ No newline at end of file diff --git a/subjects/level-up/README.md b/subjects/level-up/README.md index 1ff794c005..edea39efba 100644 --- a/subjects/level-up/README.md +++ b/subjects/level-up/README.md @@ -27,24 +27,24 @@ the string `happy` or not. The possibilities are becoming limitless... ### Instructions As Rick's robot, you are continuing your training to add yourself new ... skills -(I could have said funtions). You want now to become a robot bartender. +(I could have said funtions). You want now to become a robot barista. Define the function `shaker` which will take as arguments: - `quantity`, which will be variable of type `Number` - `fruit`, which will be a `String` -- `alcohol`, which will be a `Boolean` +- `diet`, which will be a `Boolean` `shaker` must return a `String`. Look at the examples below to understand how `shaker` must mix its ingredients: ```js console.log(shaker(1, 'strawberry', true)) -//'1 strawberry cocktail' +//'1 skinny strawberry milkshake' console.log(shaker(2, 'chocolate', false)) //'2 chocolate milkshakes' console.log(shaker(2, 'strawberry', true)) -//'2 strawberry cocktails' +//'2 skinny strawberry milkshakes' console.log(shaker(1, 'chocolate', false)) //'1 chocolate milkshake' ``` From 48473b89d4ec8dd213d819958888bc1d64600365 Mon Sep 17 00:00:00 2001 From: eslopfer Date: Thu, 29 Dec 2022 18:52:20 +0000 Subject: [PATCH 2/5] chore(level-up): fix typo --- subjects/level-up/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/level-up/README.md b/subjects/level-up/README.md index edea39efba..d75c1d1ff5 100644 --- a/subjects/level-up/README.md +++ b/subjects/level-up/README.md @@ -27,7 +27,7 @@ the string `happy` or not. The possibilities are becoming limitless... ### Instructions As Rick's robot, you are continuing your training to add yourself new ... skills -(I could have said funtions). You want now to become a robot barista. +(I could have said functions). You want now to become a robot barista. Define the function `shaker` which will take as arguments: From 337ee68d2151534c40b128cc27ded3107267d5f0 Mon Sep 17 00:00:00 2001 From: eslopfer Date: Thu, 29 Dec 2022 20:00:40 +0000 Subject: [PATCH 3/5] chore(happiness_manager): modify subject description and tests to remove references to alcohol --- js/tests/happiness-manager_test.mjs | 52 ++++++++++++++-------------- subjects/happiness-manager/README.md | 6 ++-- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/js/tests/happiness-manager_test.mjs b/js/tests/happiness-manager_test.mjs index 229dd2dd25..5f0ca61030 100644 --- a/js/tests/happiness-manager_test.mjs +++ b/js/tests/happiness-manager_test.mjs @@ -100,52 +100,52 @@ tests.push(async ({ eq, ctx }) => { }) tests.push(async ({ eq, ctx }) => { - // test when vips answer { drink: 'beer' } - // should create a list with 6-packs-beers and potatoes + // test when vips answer { drink: 'iced-tea' } + // should create a list with iced-tea-bottles and potatoes const answers = [ { answer: 'no', drink: 'beer' }, - ...ctx.createAnswers(1, { answer: 'yes', drink: 'beer' }), + ...ctx.createAnswers(1, { answer: 'yes', drink: 'iced-tea' }), ] await ctx.setAnswersIn({ dir: 'guests', answers }) - const { data } = await ctx.run('guests', 'happy-beer-list.json') - return eq(data, { potatoes: 1, '6-packs-beers': 1 }) + const { data } = await ctx.run('guests', 'happy-iced-tea-list.json') + return eq(data, { potatoes: 1, 'iced-tea-bottles': 1 }) }) tests.push(async ({ eq, ctx }) => { - // test when vips answer { drink: 'beer' } - // should create a list with 6-packs-beers and potatoes + // test when vips answer { drink: 'iced-tea' } + // should create a list with iced-tea-bottles and potatoes const answers = [ - { answer: 'no', drink: 'beer' }, - ...ctx.createAnswers(6, { answer: 'yes', drink: 'beer' }), + { answer: 'no', drink: 'iced-tea' }, + ...ctx.createAnswers(6, { answer: 'yes', drink: 'iced-tea' }), ] await ctx.setAnswersIn({ dir: 'guests', answers }) - const { data } = await ctx.run('guests', 'happy-beer-pack-list.json') - return eq(data, { potatoes: 6, '6-packs-beers': 1 }) + const { data } = await ctx.run('guests', 'happy-iced-tea-bottles-list.json') + return eq(data, { potatoes: 6, 'iced-tea-bottles': 1 }) }) tests.push(async ({ eq, ctx }) => { - // test when vips answer { drink: 'wine' } + // test when vips answer { drink: 'sparkling-water' } // should create a list with wine-bottles and potatoes const answers = [ - ...ctx.createAnswers(3, { answer: 'no', drink: 'wine' }), - ...ctx.createAnswers(5, { answer: 'yes', drink: 'wine' }), + ...ctx.createAnswers(3, { answer: 'no', drink: 'sparkling-water' }), + ...ctx.createAnswers(5, { answer: 'yes', drink: 'sparkling-water' }), ] await ctx.setAnswersIn({ dir: 'guests', answers }) - const { data } = await ctx.run('guests', 'happy-wine-list.json') - return eq(data, { potatoes: 5, 'wine-bottles': 2 }) + const { data } = await ctx.run('guests', 'happy-sparkling-water-list.json') + return eq(data, { potatoes: 5, 'sparkling-water-bottles': 2 }) }) tests.push(async ({ eq, ctx }) => { - // test when vips answer { drink: 'wine' } - // should create a list with wine-bottles and potatoes - const answers = ctx.createAnswers(8, { answer: 'yes', drink: 'wine' }) + // test when vips answer { drink: 'sparkling-water' } + // should create a list with sparkling-water-bottles and potatoes + const answers = ctx.createAnswers(8, { answer: 'yes', drink: 'sparkling-water' }) await ctx.setAnswersIn({ dir: 'guests', answers }) - const { data } = await ctx.run('guests', 'happy-wine-bottle-list.json') - return eq(data, { potatoes: 8, 'wine-bottles': 2 }) + const { data } = await ctx.run('guests', 'happy-sparkling-water-bottles-list.json') + return eq(data, { potatoes: 8, 'sparkling-water-bottles': 2 }) }) tests.push(async ({ eq, ctx }) => { @@ -365,12 +365,12 @@ tests.push(async ({ eq, ctx }) => { }), ...ctx.createAnswers(6, { answer: 'yes', food: 'vegan', drink: 'water' }), ...ctx.createAnswers(2, { answer: 'yes', food: 'veggie', drink: 'water' }), - ...ctx.createAnswers(3, { answer: 'yes', food: 'veggie', drink: 'beer' }), - ...ctx.createAnswers(11, { answer: 'yes', food: 'fish', drink: 'wine' }), + ...ctx.createAnswers(3, { answer: 'yes', food: 'veggie', drink: 'iced-tea' }), + ...ctx.createAnswers(11, { answer: 'yes', food: 'fish', drink: 'sparkling-water' }), ...ctx.createAnswers(4, { answer: 'yes', food: 'everything', - drink: 'beer', + drink: 'iced-tea', }), ] await ctx.setAnswersIn({ dir: 'guests', answers }) @@ -388,8 +388,8 @@ tests.push(async ({ eq, ctx }) => { sardines: 11, burgers: 2, kebabs: 4, - '6-packs-beers': 2, - 'wine-bottles': 3, + 'iced-tea-bottles': 2, + 'sparkling-water-bottles': 3, 'water-bottles': 2, 'soft-bottles': 1, }) diff --git a/subjects/happiness-manager/README.md b/subjects/happiness-manager/README.md index b50959a665..e8796c1e6d 100644 --- a/subjects/happiness-manager/README.md +++ b/subjects/happiness-manager/README.md @@ -29,9 +29,9 @@ The script must: You have to handle the info like this: - Drinks: - - Beers: 1 pack / 6 vips (rounded up). Expected key: `6-packs-beers`. - - Water, wine, softs: 1 bottle / 4 vips in each category (rounded up). - Expected keys: `wine-bottles`, `water-bottles`, `soft-bottles`. + - Iced tea: 1 pack / 6 vips (rounded up). Expected key: `iced-tea-bottles`. + - Water, sparkling water, softs: 1 bottle / 4 vips in each category (rounded up). + Expected keys: `sparkling-water-bottles`, `water-bottles`, `soft-bottles`. - Food: - Veggies and vegans: 1 eggplant, 1 courgette, 3 mushrooms and 1 hummus / 3 vips in these categories put together. Expected keys: `eggplants`, From 16c745ae9be6f0997d01cc09d96fea75dd9defb0 Mon Sep 17 00:00:00 2001 From: eslopfer Date: Thu, 29 Dec 2022 20:15:27 +0000 Subject: [PATCH 4/5] chore(happiness-manager): fix typos --- subjects/happiness-manager/README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/subjects/happiness-manager/README.md b/subjects/happiness-manager/README.md index e8796c1e6d..502a65fb37 100644 --- a/subjects/happiness-manager/README.md +++ b/subjects/happiness-manager/README.md @@ -7,21 +7,21 @@ As you're smart, you asked every guest of the party to precise in their answer the kind of drink they would enjoy and the kind of food they would die for. -Create a `happiness-manager.mjs` script that sort, who wants to drink what and +Create a `happiness-manager.mjs` script that sorts, who wants to drink what and who wants to eat what and integrate that in your barbecue's shopping list! -> note that you must only consider **vips** guests, those that answerd `'yes'` +> note that you must only consider as **VIP** guests, those that answered `'yes'` The script must: - Take a directory as first argument (the `guest` directory) - Take a file `.json` as second argument: - - If the file already exists, it will add the informations to it. If some elements already exist in the original file, it will be replaced by new values. + - If the file already exists, it will add the information to it. If some elements already exist in the original file, it will be replaced by new values. - If it doesn't, the script must handle the creation of the file. -- Handle case when no one answered yes to the invitation: - - `No one is coming.` has to appear in console. +- Handle the case when no one answered yes to the invitation: + - `No one is coming.` has to appear in the console. - No file is updated/created. -- Handle cases when answers contains no "food" information, or no "drink" +- Handle cases when answers contain no "food" information, or no "drink" information - Handle cases when no one has chosen a category (for example: no one chose to drink softs). This category should not appear in the final list. @@ -29,24 +29,24 @@ The script must: You have to handle the info like this: - Drinks: - - Iced tea: 1 pack / 6 vips (rounded up). Expected key: `iced-tea-bottles`. - - Water, sparkling water, softs: 1 bottle / 4 vips in each category (rounded up). + - Iced tea: 1 pack / 6 VIPs (rounded up). Expected key: `iced-tea-bottles`. + - Water, sparkling water, softs: 1 bottle / 4 VIPs in each category (rounded up). Expected keys: `sparkling-water-bottles`, `water-bottles`, `soft-bottles`. - Food: - Veggies and vegans: 1 eggplant, 1 courgette, 3 mushrooms and 1 hummus / 3 - vips in these categories put together. Expected keys: `eggplants`, + VIPs in these categories put together. Expected keys: `eggplants`, `mushrooms`, `hummus`, `courgettes`. - Carnivores: 1 burger per person. Expected key: `burgers`. - Fish lovers: 1 sardine per person. Expected key: `sardines`. - Omnivores: 1 chicken+shrimps+pepper kebab / person. Expected key: `kebabs`. - - Bonus: you'll add 1 potatoe per person (all categories put together). + - Bonus: you'll add 1 potato per person (all categories put together). Expected key: `potatoes`. -The infos have to be formated like this in the `.json` file: +The info has to be formated like this in the `.json` file: ```js { - "key": 1 // according to actual number associated to the elem + "key": 1 // according to actual number associated to the element } ``` From ca0881b4c6028a40ee6c9770096b68b51fbfc55c Mon Sep 17 00:00:00 2001 From: eslopfer Date: Thu, 29 Dec 2022 20:17:44 +0000 Subject: [PATCH 5/5] chore(happiness_manager): remove wine reference that slipped through --- js/tests/happiness-manager_test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/tests/happiness-manager_test.mjs b/js/tests/happiness-manager_test.mjs index 5f0ca61030..f651cdc6bf 100644 --- a/js/tests/happiness-manager_test.mjs +++ b/js/tests/happiness-manager_test.mjs @@ -127,7 +127,7 @@ tests.push(async ({ eq, ctx }) => { tests.push(async ({ eq, ctx }) => { // test when vips answer { drink: 'sparkling-water' } - // should create a list with wine-bottles and potatoes + // should create a list with sparkling-water-bottles and potatoes const answers = [ ...ctx.createAnswers(3, { answer: 'no', drink: 'sparkling-water' }), ...ctx.createAnswers(5, { answer: 'yes', drink: 'sparkling-water' }),