-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
65 lines (46 loc) · 1.13 KB
/
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
const { addFlower, findExpensiveFlowers } = require("./flowers.js")
addFlower({
color: "Orange",
species: "Tulip",
price: 0.95
})
addFlower({
color: "White",
species: "Baby Breath",
price: 0.40
})
addFlower({
color: "Blue",
species: "Orchid",
price: 1.05
})
const expensiveFlowers = findExpensiveFlowers()
console.log(`
Test: Three new flowers added to array.
Price #1 is 0.95
Price #2 is 0.40
Price #3 is 1.05
`)
if (expensiveFlowers.length !== 2 || Array.isArray(expensiveFlowers[0])) {
console.log(`
*************************
**** TEST FAILED ****
*************************
The test code expected that two flowers should be
in the expensiveFlowers array, and that each item
in the array is an object.
Make sure that you have an \`if\` condition that
is checking the price property of each flower, and
that only flowers whose price is >= 1.00 are being
added.
`)
} else {
console.log(`
****************************
**** TEST SUCCEEDED ****
****************************
Congratulations on writing valid code for your first
self-assessment project.
`)
}
console.log(expensiveFlowers)