(t *testing.T)
| 224 | } |
| 225 | |
| 226 | func TestGitPluginURL(t *testing.T) { |
| 227 | testCases := []struct { |
| 228 | name string |
| 229 | ref string |
| 230 | subpath string |
| 231 | expected string |
| 232 | }{ |
| 233 | { |
| 234 | name: "basic plugin.json", |
| 235 | ref: "git+https://github.com/jetify-com/devbox-plugins.git", |
| 236 | subpath: "plugin.json", |
| 237 | expected: "plugin.json", |
| 238 | }, |
| 239 | { |
| 240 | name: "plugin with directory", |
| 241 | ref: "git+https://github.com/jetify-com/devbox-plugins.git?dir=mongodb", |
| 242 | subpath: "plugin.json", |
| 243 | expected: "mongodb/plugin.json", |
| 244 | }, |
| 245 | { |
| 246 | name: "plugin with ref", |
| 247 | ref: "git+https://github.com/jetify-com/devbox-plugins.git?ref=main", |
| 248 | subpath: "plugin.json", |
| 249 | expected: "plugin.json", |
| 250 | }, |
| 251 | { |
| 252 | name: "plugin with directory and ref", |
| 253 | ref: "git+https://github.com/jetify-com/devbox-plugins.git?dir=mongodb&ref=my-branch", |
| 254 | subpath: "plugin.json", |
| 255 | expected: "mongodb/plugin.json", |
| 256 | }, |
| 257 | { |
| 258 | name: "plugin with subgroups", |
| 259 | ref: "git+https://gitlab.com/group/subgroup/repo.git", |
| 260 | subpath: "plugin.json", |
| 261 | expected: "plugin.json", |
| 262 | }, |
| 263 | { |
| 264 | name: "plugin with SSH URL", |
| 265 | ref: "git+ssh://git@github.com/jetify-com/devbox-plugins.git", |
| 266 | subpath: "plugin.json", |
| 267 | expected: "plugin.json", |
| 268 | }, |
| 269 | { |
| 270 | name: "plugin with file URL", |
| 271 | ref: "git+file:///tmp/local-repo.git", |
| 272 | subpath: "plugin.json", |
| 273 | expected: "plugin.json", |
| 274 | }, |
| 275 | } |
| 276 | |
| 277 | for _, testCase := range testCases { |
| 278 | t.Run(testCase.name, func(t *testing.T) { |
| 279 | ref, err := flake.ParseRef(testCase.ref) |
| 280 | if err != nil { |
| 281 | t.Fatalf("Failed to parse ref %q: %v", testCase.ref, err) |
| 282 | } |
| 283 |
nothing calls this directly
no test coverage detected