(t *testing.T)
| 150 | } |
| 151 | |
| 152 | func TestPendingLegacyModule(t *testing.T) { |
| 153 | t.Parallel() |
| 154 | |
| 155 | ws := &workspace.Workspace{Root: "/repo", Path: "."} |
| 156 | resolveLocalRef := func(_ *workspace.Workspace, relPath string) string { |
| 157 | return "/resolved/" + relPath |
| 158 | } |
| 159 | |
| 160 | t.Run("preserves remote pin", func(t *testing.T) { |
| 161 | t.Parallel() |
| 162 | |
| 163 | mod := pendingLegacyModule( |
| 164 | ws, |
| 165 | resolveLocalRef, |
| 166 | "go", |
| 167 | "github.com/acme/go-toolchain@main", |
| 168 | "abc123", |
| 169 | false, |
| 170 | map[string]any{"foo": "bar"}, |
| 171 | []*modules.ModuleConfigArgument{{ |
| 172 | Argument: "config", |
| 173 | DefaultPath: "./custom-config.txt", |
| 174 | }}, |
| 175 | ) |
| 176 | |
| 177 | require.Equal(t, "github.com/acme/go-toolchain@main", mod.Ref) |
| 178 | require.Equal(t, "abc123", mod.RefPin) |
| 179 | require.Equal(t, "go", mod.Name) |
| 180 | require.False(t, mod.Entrypoint) |
| 181 | require.True(t, mod.LegacyDefaultPath) |
| 182 | require.Equal(t, map[string]any{"foo": "bar"}, mod.ConfigDefaults) |
| 183 | require.Len(t, mod.ArgCustomizations, 1) |
| 184 | require.Equal(t, "./custom-config.txt", mod.ArgCustomizations[0].DefaultPath) |
| 185 | }) |
| 186 | |
| 187 | t.Run("resolves local refs without ref pin", func(t *testing.T) { |
| 188 | t.Parallel() |
| 189 | |
| 190 | mod := pendingLegacyModule( |
| 191 | ws, |
| 192 | resolveLocalRef, |
| 193 | "blueprint", |
| 194 | "../blueprint", |
| 195 | "", |
| 196 | true, |
| 197 | nil, |
| 198 | nil, |
| 199 | ) |
| 200 | |
| 201 | require.Equal(t, "/resolved/../blueprint", mod.Ref) |
| 202 | require.Empty(t, mod.RefPin) |
| 203 | require.Equal(t, "blueprint", mod.Name) |
| 204 | require.True(t, mod.Entrypoint) |
| 205 | require.True(t, mod.LegacyDefaultPath) |
| 206 | require.Nil(t, mod.ConfigDefaults) |
| 207 | }) |
| 208 | } |
| 209 |
nothing calls this directly
no test coverage detected