MCPcopy Create free account
hub / github.com/github/gh-aw / TestNormalizeTimeTokens

Function TestNormalizeTimeTokens

pkg/parser/schedule_time_utils_test.go:209–258  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

207}
208
209func TestNormalizeTimeTokens(t *testing.T) {
210 tests := []struct {
211 name string
212 tokens []string
213 expected string
214 }{
215 {
216 name: "single time token",
217 tokens: []string{"12:30"},
218 expected: "12:30",
219 },
220 {
221 name: "time with AM",
222 tokens: []string{"9", "am"},
223 expected: "9 am",
224 },
225 {
226 name: "time with PM",
227 tokens: []string{"3", "pm"},
228 expected: "3 pm",
229 },
230 {
231 name: "time with UTC offset",
232 tokens: []string{"14:00", "utc+9"},
233 expected: "14:00 utc+9",
234 },
235 {
236 name: "time with AM and UTC",
237 tokens: []string{"9", "am", "utc-5"},
238 expected: "9 am utc-5",
239 },
240 {
241 name: "time with timezone abbreviation",
242 tokens: []string{"10:00", "pst"},
243 expected: "10:00 utc-8",
244 },
245 {
246 name: "empty tokens",
247 tokens: []string{},
248 expected: "",
249 },
250 }
251
252 for _, tt := range tests {
253 t.Run(tt.name, func(t *testing.T) {
254 result := normalizeTimeTokens(tt.tokens)
255 assert.Equal(t, tt.expected, result, "normalizeTimeTokens(%v) should return %q", tt.tokens, tt.expected)
256 })
257 }
258}

Callers

nothing calls this directly

Calls 2

normalizeTimeTokensFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected