-
Notifications
You must be signed in to change notification settings - Fork 885
/
restaurant-test.js
119 lines (98 loc) · 5.18 KB
/
restaurant-test.js
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var assert = require('chai').assert;
var { createMeal, getMade, createOrder, cookMeal, listOrders, announceMeal, listSpecialRequests } = require('./restaurant');
describe('Meal', function () {
it.skip('should have a name, special requests, and table number', function () {
var shrimpTacos = createMeal('Shrimp Tacos', ["no cheese"], 14);
var appetizer = createMeal('Jicama & Cucumber Salad', [], 12);
assert.equal(shrimpTacos.name, 'Shrimp Tacos');
assert.deepEqual(shrimpTacos.specialRequests, ["no cheese"]);
assert.equal(shrimpTacos.tableNumber, 14);
assert.equal(appetizer.name, 'Jicama & Cucumber Salad');
assert.deepEqual(appetizer.specialRequests, []);
assert.equal(appetizer.tableNumber, 12);
});
it.skip('should default to not complete', function () {
var appetizer = createMeal('Chips & Salsa', [], 14);
assert.equal(appetizer.complete, false);
});
it.skip('should be able to be completed', function () {
var appetizer = createMeal('Chips & Queso', [], 4);
var pizza = createMeal('Margarita', [], 5)
var shrimpTacos = createMeal('Shrimp Tacos', ["no cheese"], 14);
var completeAppetizer = getMade(appetizer);
var completeTacos = getMade(shrimpTacos);
assert.equal(completeAppetizer.complete, true)
assert.equal(completeTacos.complete, true);
assert.equal(pizza.complete, false);
});
it.skip('should be able to return a message if the order is completed', function () {
var appetizer = createMeal('Chips & Queso', [], 4);
var pizza = createMeal('Margarita pizza', [], 5)
var completeAppetizer = getMade(appetizer);
var messageOne = announceMeal(completeAppetizer)
var messageTwo = announceMeal(pizza)
assert.equal(messageOne, 'Order up - Chips & Queso for table 4!');
assert.equal(messageTwo, 'This Margarita pizza is not completed yet');
})
})
describe('Order', function () {
it.skip('should have a table number and associated meals', function () {
var meal1 = createMeal('Shrimp Tacos', ['no cheese'], 14);
var meal2 = createMeal('Jicama & Cucumber', [], 14);
var meal3 = createMeal('The Situation Gordita', ['cilantro', 'onion'], 14);
var meals = [meal1, meal2, meal3];
var order = createOrder({ name: 14, meals: meals });
assert.equal(order.tableNumber, 14);
assert.equal(order.meals, meals);
});
it.skip('should have no complete meals by default', function () {
var meal1 = createMeal('Pico de Gallo Quesadillas', [], 3);
var meal2 = createMeal('Sombra Shroom Griddled Tacos', ['crema'], 3);
var meal3 = createMeal('The Situation Gordita', ["cilantro", "onion"], 3);
var meals = [meal1, meal2, meal3];
var order = createOrder({ name: 3, meals: meals });
assert.deepEqual(order.completedMeals, []);
});
it.skip('should be able to cook meals', function () {
var meal1 = createMeal('Pico de Gallo Quesadillas', [], 3);
var meal2 = createMeal('Sombra Shroom Griddled Tacos', ['crema'], 3);
var meal3 = createMeal('The Situation Gordita', ['cilantro', 'onion'], 3);
var meals = [meal1, meal2, meal3];
var order = createOrder({ name: 3, meals: meals });
var updateOrder = cookMeal(order, meal1);
assert.deepEqual(updateOrder.completedMeals.length, 1);
assert.deepEqual(updateOrder.completedMeals[0], 'Pico de Gallo Quesadillas');
var updatedOrder2 = cookMeal(order, meal2);
assert.deepEqual(updatedOrder2.completedMeals.length, 2);
assert.deepEqual(updatedOrder2.completedMeals[1], 'Sombra Shroom Griddled Tacos');
});
it.skip('should only cook meals for the correct table', function () {
var meal1 = createMeal('Pico de Gallo Quesadillas', [], 3);
var meal2 = createMeal('Sombra Shroom Griddled Tacos', ['crema'], 3);
var meal3 = createMeal('The Situation Gordita', ['cilantro', 'onion'], 5);
var meals = [meal1, meal2, meal3];
var order = createOrder({ name: 3, meals: meals });
var updatedOrder3 = cookMeal(order, meal3);
assert.deepEqual(updatedOrder3.completedMeals.length, 0);
});
it.skip('should be able to list all orders', function () {
var meal1 = createMeal('Pico de Gallo Quesadillas', ['to go'], 3);
var meal2 = createMeal('Sombra Shroom Griddled Tacos', ['crema on the side'], 3);
var meal3 = createMeal('The Situation Gordita', ['add cilantro', 'no onion'], 3);
var meals = [meal1, meal2, meal3];
var order = createOrder({ name: 'Table 3', meals: meals });
var orderNames = listOrders(order)
assert.equal(orderNames.length, 3);
assert.deepEqual(orderNames, ['Pico de Gallo Quesadillas', 'Sombra Shroom Griddled Tacos', 'The Situation Gordita']);
});
it.skip('should be able to list all special requests', function () {
var meal1 = createMeal('Pico de Gallo Quesadillas', ['to go'], 3);
var meal2 = createMeal('Sombra Shroom Griddled Tacos', ['crema on the side'], 3);
var meal3 = createMeal('The Situation Gordita', ['add cilantro', 'no onion'], 3);
var meals = [meal1, meal2, meal3];
var order = createOrder({ name: 'Table 3', meals: meals });
var specialRequests = listSpecialRequests(order)
assert.equal(specialRequests.length, 4);
assert.deepEqual(specialRequests, ['to go', 'crema on the side', 'add cilantro', 'no onion']);
});
})