You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
input: "Create a comprehensive workflow that automatically triages GitHub issues by analyzing their content, assigning appropriate labels, and notifying relevant team members",
264
+
expectError: false,
265
+
},
266
+
{
267
+
name: "valid exactly 20 characters",
268
+
input: "12345678901234567890",
269
+
expectError: false,
270
+
},
271
+
{
272
+
name: "valid with newlines",
273
+
input: "Create a workflow to\ntriage issues automatically",
274
+
expectError: false,
275
+
},
276
+
{
277
+
name: "valid with leading/trailing whitespace",
278
+
input: " Create a workflow to triage issues ",
279
+
expectError: false,
280
+
},
281
+
{
282
+
name: "empty string",
283
+
input: "",
284
+
expectError: true,
285
+
errorMsg: "workflow instructions cannot be empty",
286
+
},
287
+
{
288
+
name: "only whitespace",
289
+
input: " \t\n ",
290
+
expectError: true,
291
+
errorMsg: "workflow instructions cannot be empty",
292
+
},
293
+
{
294
+
name: "only spaces",
295
+
input: " ",
296
+
expectError: true,
297
+
errorMsg: "workflow instructions cannot be empty",
298
+
},
299
+
{
300
+
name: "only tabs",
301
+
input: "\t\t\t",
302
+
expectError: true,
303
+
errorMsg: "workflow instructions cannot be empty",
304
+
},
305
+
{
306
+
name: "only newlines",
307
+
input: "\n\n\n",
308
+
expectError: true,
309
+
errorMsg: "workflow instructions cannot be empty",
310
+
},
311
+
{
312
+
name: "too short - single character",
313
+
input: "a",
314
+
expectError: true,
315
+
errorMsg: "please provide at least 20 characters of instructions",
316
+
},
317
+
{
318
+
name: "too short - 5 characters",
319
+
input: "hello",
320
+
expectError: true,
321
+
errorMsg: "please provide at least 20 characters of instructions",
322
+
},
323
+
{
324
+
name: "too short - 19 characters",
325
+
input: "1234567890123456789",
326
+
expectError: true,
327
+
errorMsg: "please provide at least 20 characters of instructions",
328
+
},
329
+
{
330
+
name: "too short with whitespace padding",
331
+
input: " test ",
332
+
expectError: true,
333
+
errorMsg: "please provide at least 20 characters of instructions",
334
+
},
335
+
{
336
+
name: "19 chars after trim",
337
+
input: " 1234567890123456789 ",
338
+
expectError: true,
339
+
errorMsg: "please provide at least 20 characters of instructions",
340
+
},
341
+
}
342
+
343
+
for_, tt:=rangetests {
344
+
t.Run(tt.name, func(t*testing.T) {
345
+
err:=ValidateWorkflowIntent(tt.input)
346
+
347
+
iftt.expectError {
348
+
iferr==nil {
349
+
t.Errorf("ValidateWorkflowIntent(%q) expected error but got nil", tt.input)
0 commit comments