forked from parasmehta/cocktail-finder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.test.js
31 lines (28 loc) · 855 Bytes
/
server.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
const getMatchingDrinks = require("./server");
describe(getMatchingDrinks, async () => {
it(" returns an empty array when ingredients are empty", async () => {
const result1 = await getMatchingDrinks([]);
expect(result1).toBe([]);
});
it(" returns an empty array when no matching cocktails are found", async () => {
const result2 = await getMatchingDrinks(["test"]);
expect(result2).toBe([]);
});
it(" returns the matching cocktails containing the ingredients", async () => {
const result3 = await getMatchingDrinks(["sugar", "lime juice"]);
expect(result3).toEqual([
{
id: "11064",
name: "Banana Daiquiri",
ingredients: [
"Light rum",
"Triple sec",
"Banana",
"Lime juice",
"Sugar",
"Cherry"
]
}
]);
});
});