Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CON-1035 Remove alcohol terminology #1691

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions js/tests/happiness-manager_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
// should create a list with wine-bottles and potatoes
// test when vips answer { drink: 'sparkling-water' }
// should create a list with sparkling-water-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 }) => {
Expand Down Expand Up @@ -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 })
Expand All @@ -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,
})
Expand Down
10 changes: 5 additions & 5 deletions js/tests/level-up.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
"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.",
"code": "equal(shaker(22, 'banana', false), '22 banana milkshakes')"
},
{
"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')"
}
]
26 changes: 13 additions & 13 deletions subjects/happiness-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,46 @@
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.

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`,
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
}
```

Expand Down
8 changes: 4 additions & 4 deletions subjects/level-up/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 functions). 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'
```
Expand Down
Loading