(t *testing.T)
| 549 | } |
| 550 | |
| 551 | func TestExtractSafeJobsFromFrontmatter(t *testing.T) { |
| 552 | frontmatter := map[string]any{ |
| 553 | "safe-outputs": map[string]any{ |
| 554 | "jobs": map[string]any{ |
| 555 | "deploy": map[string]any{ |
| 556 | "runs-on": "ubuntu-latest", |
| 557 | "inputs": map[string]any{ |
| 558 | "environment": map[string]any{ |
| 559 | "description": "Target environment", |
| 560 | "required": true, |
| 561 | "type": "choice", |
| 562 | "options": []any{"staging", "production"}, |
| 563 | }, |
| 564 | }, |
| 565 | }, |
| 566 | }, |
| 567 | }, |
| 568 | } |
| 569 | |
| 570 | result := extractSafeJobsFromFrontmatter(frontmatter) |
| 571 | |
| 572 | if len(result) != 1 { |
| 573 | t.Errorf("Expected 1 safe-job, got %d", len(result)) |
| 574 | } |
| 575 | |
| 576 | deployJob, exists := result["deploy"] |
| 577 | if !exists { |
| 578 | t.Error("Expected 'deploy' job to exist") |
| 579 | } |
| 580 | |
| 581 | if deployJob.RunsOn != "ubuntu-latest" { |
| 582 | t.Errorf("Expected runs-on to be 'ubuntu-latest', got '%s'", deployJob.RunsOn) |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | func TestMergeSafeJobs(t *testing.T) { |
| 587 | base := map[string]*SafeJobConfig{ |
nothing calls this directly
no test coverage detected