-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_test.go
More file actions
56 lines (47 loc) · 1003 Bytes
/
make_test.go
File metadata and controls
56 lines (47 loc) · 1003 Bytes
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
package main
import (
"testing"
c "delivery/config"
)
func init() {
c.Init("config.yml")
}
func TestReadOrders(t *testing.T) {
orders, err := readOrders("orders_test.json")
if err != nil {
t.Fatal(err)
}
want := 132
got := len(orders)
if got != want {
t.Errorf("got %v want %v", got, want)
}
}
func TestCreateShelvesFromConfig(t *testing.T) {
c.Config.Shelves = []struct {
Name string `yaml:"name"`
Temperature string `yaml:"temp"`
Capacity int `yaml:"cap"`
DecayModifier int `yaml:"decayModifier"`
}{{
Name: "Frozen shelf",
Temperature: "frozen",
Capacity: 10,
DecayModifier: 1,
}, {
Name: "Cold shelf",
Temperature: "cold",
Capacity: 10,
DecayModifier: 1,
}, {
Name: "Hot shelf",
Temperature: "hot",
Capacity: 10,
DecayModifier: 1,
}}
want := len(c.Config.Shelves)
got := len(createShelvesFromConfig())
if got != want {
t.Errorf("got %d want %d", got, want)
}
}