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

Function TestSpec_ScheduleDetection_IsCronExpression

pkg/parser/spec_test.go:203–238  ·  view source on GitHub ↗

TestSpec_ScheduleDetection_IsCronExpression validates the documented behavior of IsCronExpression as described in the package README.md. Specification: Detects whether a string is already a cron expression.

(t *testing.T)

Source from the content-addressed store, hash-verified

201//
202// Specification: Detects whether a string is already a cron expression.
203func TestSpec_ScheduleDetection_IsCronExpression(t *testing.T) {
204 tests := []struct {
205 name string
206 input string
207 expected bool
208 }{
209 {
210 name: "standard 5-field cron returns true",
211 input: "0 9 * * *",
212 expected: true,
213 },
214 {
215 name: "every-5-minutes cron returns true",
216 input: "*/5 * * * *",
217 expected: true,
218 },
219 {
220 name: "natural language schedule returns false",
221 input: "every day at 9am",
222 expected: false,
223 },
224 {
225 name: "empty string returns false",
226 input: "",
227 expected: false,
228 },
229 }
230
231 for _, tt := range tests {
232 t.Run(tt.name, func(t *testing.T) {
233 result := IsCronExpression(tt.input)
234 assert.Equal(t, tt.expected, result,
235 "IsCronExpression(%q) should detect cron format correctly", tt.input)
236 })
237 }
238}
239
240// TestSpec_ScheduleDetection_IsDailyCron validates the documented behavior of
241// IsDailyCron as described in the package README.md.

Callers

nothing calls this directly

Calls 2

IsCronExpressionFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected