MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / TestValidatePRInfoV1_3

Function TestValidatePRInfoV1_3

internal/prinfo/prinfo_test.go:360–440  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

358}
359
360func TestValidatePRInfoV1_3(t *testing.T) {
361 testCases := []struct {
362 name string
363 data string
364 wantErr bool
365 }{
366 {
367 name: "v1.3 author as object",
368 data: `{
369 "platform": "github",
370 "type": "pull_request",
371 "number": "123",
372 "url": "https://github.com/owner/repo/pull/123",
373 "author": {"login": "dependabot[bot]", "type": "Bot"}
374 }`,
375 wantErr: false,
376 },
377 {
378 name: "v1.3 author as string (backwards compat)",
379 data: `{
380 "platform": "github",
381 "type": "pull_request",
382 "number": "123",
383 "url": "https://github.com/owner/repo/pull/123",
384 "author": "username"
385 }`,
386 wantErr: false,
387 },
388 {
389 name: "v1.3 author object missing type",
390 data: `{
391 "platform": "github",
392 "type": "pull_request",
393 "number": "123",
394 "url": "https://github.com/owner/repo/pull/123",
395 "author": {"login": "username"}
396 }`,
397 wantErr: true,
398 },
399 {
400 name: "v1.3 author object invalid type",
401 data: `{
402 "platform": "github",
403 "type": "pull_request",
404 "number": "123",
405 "url": "https://github.com/owner/repo/pull/123",
406 "author": {"login": "username", "type": "InvalidType"}
407 }`,
408 wantErr: true,
409 },
410 {
411 name: "v1.3 with reviewers and object author",
412 data: `{
413 "platform": "github",
414 "type": "pull_request",
415 "number": "789",
416 "url": "https://github.com/owner/repo/pull/789",
417 "author": {"login": "renovate[bot]", "type": "Bot"},

Callers

nothing calls this directly

Calls 3

ValidatePRInfoFunction · 0.92
ErrorMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected