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

Function TestExtractSafeJobsFromFrontmatter

pkg/workflow/safe_jobs_test.go:551–584  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

549}
550
551func 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
586func TestMergeSafeJobs(t *testing.T) {
587 base := map[string]*SafeJobConfig{

Callers

nothing calls this directly

Calls 3

ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected