TestResolveImportPath_RunPushOpts characterises the run_push.go call-site preset: section refs are stripped, workflowspec paths return "", and relative paths are joined with baseDir.
(t *testing.T)
| 69 | // section refs are stripped, workflowspec paths return "", and relative paths are |
| 70 | // joined with baseDir. |
| 71 | func TestResolveImportPath_RunPushOpts(t *testing.T) { |
| 72 | tmpDir := t.TempDir() |
| 73 | baseDir := filepath.Join(tmpDir, "workflows") |
| 74 | require.NoError(t, os.MkdirAll(baseDir, 0755)) |
| 75 | |
| 76 | opts := importPathResolverOpts{ |
| 77 | StripSectionRef: true, |
| 78 | WorkflowSpecSkip: true, |
| 79 | } |
| 80 | |
| 81 | tests := []struct { |
| 82 | name string |
| 83 | importPath string |
| 84 | expected string |
| 85 | }{ |
| 86 | { |
| 87 | name: "relative path", |
| 88 | importPath: "shared/file.md", |
| 89 | expected: filepath.Join(baseDir, "shared/file.md"), |
| 90 | }, |
| 91 | { |
| 92 | name: "section ref is stripped", |
| 93 | importPath: "shared/file.md#section", |
| 94 | expected: filepath.Join(baseDir, "shared/file.md"), |
| 95 | }, |
| 96 | { |
| 97 | name: "workflowspec with @ returns empty", |
| 98 | importPath: "owner/repo/path/file.md@abc123", |
| 99 | expected: "", |
| 100 | }, |
| 101 | { |
| 102 | name: "workflowspec without @ returns empty", |
| 103 | importPath: "owner/repo/path/file.md", |
| 104 | expected: "", |
| 105 | }, |
| 106 | } |
| 107 | |
| 108 | for _, tt := range tests { |
| 109 | t.Run(tt.name, func(t *testing.T) { |
| 110 | result := resolveImportPath(tt.importPath, baseDir, opts) |
| 111 | assert.Equal(t, tt.expected, result, |
| 112 | "resolveImportPath(%q, %q, runPushOpts) = %q", tt.importPath, baseDir, result) |
| 113 | }) |
| 114 | } |
| 115 | } |
nothing calls this directly
no test coverage detected