-
Notifications
You must be signed in to change notification settings - Fork 1
/
fixtures_test.go
166 lines (157 loc) · 5.12 KB
/
fixtures_test.go
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package server_test
import (
"time"
server "github.com/brackendawson/webcal-proxy"
)
func daysSeptember2024In(l *time.Location) []server.Day {
return []server.Day{
{Time: time.Date(2024, 8, 26, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 8, 27, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 8, 28, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 8, 29, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 8, 30, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 8, 31, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 1, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 2, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 3, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 4, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 5, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 6, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 7, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 8, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 9, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 10, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 11, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 12, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 13, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 14, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 15, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 16, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 17, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 18, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 19, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 20, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 21, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 22, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 23, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 24, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 25, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 26, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 27, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 28, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 29, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 9, 30, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 10, 1, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 10, 2, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 10, 3, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 10, 4, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 10, 5, 0, 0, 0, 0, l)},
{Time: time.Date(2024, 10, 6, 0, 0, 0, 0, l)},
}
}
var (
locSydney = must(time.LoadLocation("Australia/Sydney"))
locNewYork = must(time.LoadLocation("America/New_York"))
daysSept2024WithEvents = func() []server.Day {
c := daysSeptember2024In(time.UTC)
c[10+5].Events = []server.Event{
{
StartTime: time.Date(2024, 9, 10, 11, 0, 0, 0, time.UTC),
EndTime: time.Date(2024, 9, 10, 11, 0, 0, 0, time.UTC),
Summary: "Meeting",
Location: "Office",
Description: "Take notes",
},
}
c[11+5].Events = []server.Event{
{
StartTime: time.Date(2024, 9, 11, 11, 0, 0, 0, time.UTC),
EndTime: time.Date(2024, 9, 11, 12, 0, 0, 0, time.UTC),
Summary: "Picnic",
Location: "Park",
},
}
c[2+30+5].Events = []server.Event{
{
StartTime: time.Date(2024, 10, 2, 0, 0, 0, 0, time.UTC),
EndTime: time.Date(2024, 10, 3, 0, 0, 0, 0, time.UTC),
Summary: "Barbie's birthday",
Description: "bring cake",
},
}
return c
}()
daysSept2024WithAllDayEvent = func() []server.Day {
c := daysSeptember2024In(time.UTC)
c[23+5].Events = []server.Event{
{
StartTime: time.Date(2024, 9, 23, 0, 0, 0, 0, time.UTC),
EndTime: time.Date(2024, 9, 24, 0, 0, 0, 0, time.UTC),
Summary: "Meeting",
Location: "Office",
Description: "Talk",
},
}
return c
}()
daysSept2024WithMultiDayEvent = func() []server.Day {
c := daysSeptember2024In(time.UTC)
c[22+5].Events = []server.Event{
{
StartTime: time.Date(2024, 9, 22, 11, 0, 0, 0, time.UTC),
EndTime: time.Date(2024, 9, 24, 11, 0, 0, 0, time.UTC),
Summary: "Festival",
},
}
c[23+5].Events = []server.Event{
{
StartTime: time.Date(2024, 9, 22, 11, 0, 0, 0, time.UTC),
EndTime: time.Date(2024, 9, 24, 11, 0, 0, 0, time.UTC),
Summary: "Festival",
},
}
c[24+5].Events = []server.Event{
{
StartTime: time.Date(2024, 9, 22, 11, 0, 0, 0, time.UTC),
EndTime: time.Date(2024, 9, 24, 11, 0, 0, 0, time.UTC),
Summary: "Festival",
},
}
return c
}()
daysSept2024WithEventsSydney = func() []server.Day {
c := daysSeptember2024In(locSydney)
c[10+5].Events = []server.Event{
{
StartTime: time.Date(2024, 9, 10, 11, 0, 0, 0, time.UTC).In(locSydney),
EndTime: time.Date(2024, 9, 10, 11, 0, 0, 0, time.UTC).In(locSydney),
Summary: "Meeting",
Location: "Office",
Description: "Take notes",
},
}
c[11+5].Events = []server.Event{
{
StartTime: time.Date(2024, 9, 11, 11, 0, 0, 0, time.UTC).In(locSydney),
EndTime: time.Date(2024, 9, 11, 12, 0, 0, 0, time.UTC).In(locSydney),
Summary: "Picnic",
Location: "Park",
},
}
c[2+30+5].Events = []server.Event{
{
StartTime: time.Date(2024, 10, 2, 0, 0, 0, 0, locSydney),
EndTime: time.Date(2024, 10, 3, 0, 0, 0, 0, locSydney),
Summary: "Barbie's birthday",
Description: "bring cake",
},
}
return c
}()
)
func must[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
}