forked from turingschool-examples/javascript-foundations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtacoStand-test.js
More file actions
100 lines (74 loc) · 3.47 KB
/
tacoStand-test.js
File metadata and controls
100 lines (74 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
var assert = require('chai').assert
var { createIngredient, createTaco, addIngredientToTaco, calculatePrice } = require('./tacoStand')
describe('taco stand', function() {
describe('createIngredient', function() {
it.skip('should take a name and price', function() {
const ingredient1 = createIngredient('chicken', 2.50)
const ingredient2 = createIngredient('steak', 3.25)
assert.equal(ingredient1.name, 'chicken')
assert.equal(ingredient1.price, 2.50)
assert.equal(ingredient2.name, 'steak')
assert.equal(ingredient2.price, 3.25)
})
it.skip('should return an ingredient with defaults if nothing is passed', function() {
const defaultIngredient = createIngredient()
assert.equal(defaultIngredient.name, 'unknown')
assert.equal(defaultIngredient.price, 0.00)
})
})
describe('createTaco', function() {
it.skip('should have a name', function() {
assert.equal(createTaco('southwestern').name, 'southwestern')
})
it.skip('should have a default name if none provided', function() {
assert.equal(createTaco().name, 'custom')
})
it.skip('should have no ingredients by default', function() {
assert.deepEqual(createTaco('baja').ingredients, [])
})
it.skip('should be able to create a taco with ingredients', function() {
const fish = createIngredient('fish', 2.95)
const hotSauce = createIngredient('siracha mayo', 0.95)
const lettuce = createIngredient('lettuce', 0.50)
const ingredients = [fish, hotSauce, lettuce]
const bajaTaco = createTaco('baja', ingredients)
assert.deepEqual(bajaTaco.ingredients, ingredients)
})
})
describe('addIngredientToTaco', function() {
it.skip('should be able to add an ingredient to a taco', function() {
const steak = createIngredient('steak', 3.50)
const basicSteakTaco = createTaco('basic steak', [steak])
const lettuce = createIngredient('lettuce', 0.50)
const lettuceAddedTaco = addIngredientToTaco(basicSteakTaco, lettuce)
assert.deepEqual(lettuceAddedTaco.ingredients, [steak, lettuce])
})
it.skip('should return the taco unchanged if no ingredient is included', function() {
const steak = createIngredient('steak', 3.50)
const basicSteakTaco = createTaco('basic steak', [steak])
const nothingAddedTaco = addIngredientToTaco(basicSteakTaco)
assert.deepEqual(nothingAddedTaco, basicSteakTaco)
})
})
describe('calculatePrice', function() {
it.skip('should calculate the price of a single ingredient taco', function() {
const steak = createIngredient('steak', 3.50)
const basicSteakTaco = createTaco('basic steak', [steak])
assert.equal(calculatePrice(basicSteakTaco), 3.50)
})
it.skip('should calculate the price of a 2 ingredient taco', function() {
const steak = createIngredient('steak', 3.50)
const lettuce = createIngredient('lettuce', 0.50)
const steakTaco = createTaco('steak', [steak, lettuce])
assert.equal(calculatePrice(steakTaco), 4.00)
})
it.skip('should calculate the price of a many ingredient taco', function() {
const steak = createIngredient('steak', 3.50)
const lettuce = createIngredient('lettuce', 0.50)
const hotSauce = createIngredient('siracha mayo', 0.95)
const salsa = createIngredient('salsa', 0.75)
const steakTaco = createTaco('steak', [steak, lettuce, hotSauce, salsa])
assert.equal(calculatePrice(steakTaco), 5.70)
})
})
})