Browse Source

chore(happiness_manager): modify subject description and tests to remove references to alcohol

pull/1691/head
eslopfer 2 years ago
parent
commit
337ee68d21
  1. 52
      js/tests/happiness-manager_test.mjs
  2. 6
      subjects/happiness-manager/README.md

52
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,
})

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

Loading…
Cancel
Save