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)
| 201 | // |
| 202 | // Specification: Detects whether a string is already a cron expression. |
| 203 | func 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. |
nothing calls this directly
no test coverage detected