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

Function TestIsCronExpression

pkg/parser/schedule_cron_detection_test.go:11–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestIsCronExpression(t *testing.T) {
12 tests := []struct {
13 name string
14 input string
15 expected bool
16 }{
17 {"midnight daily", "0 0 * * *", true},
18 {"every 15 minutes", "*/15 * * * *", true},
19 {"weekdays at 2pm", "0 14 * * 1-5", true},
20 {"monday at 6:30am", "30 6 * * 1", true},
21 {"christmas noon", "0 12 25 12 *", true},
22 {"natural language daily", "daily", false},
23 {"natural language weekly", "weekly on monday", false},
24 {"natural language interval", "every 10 minutes", false},
25 {"too few fields", "0 0 * *", false},
26 {"too many fields", "0 0 * * * *", false},
27 {"extra tokens", "0 0 * * * extra", false},
28 {"invalid expression", "invalid cron expression", false},
29 {"empty string", "", false},
30 }
31
32 for _, tt := range tests {
33 t.Run(tt.name, func(t *testing.T) {
34 result := IsCronExpression(tt.input)
35 assert.Equal(t, tt.expected, result, "IsCronExpression(%q)", tt.input)
36 })
37 }
38}
39
40func TestIsDailyCron(t *testing.T) {
41 tests := []struct {

Callers

nothing calls this directly

Calls 2

IsCronExpressionFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected