MCPcopy Create free account
hub / github.com/compozy/agh / TestClientRepositoryWithoutReleases

Function TestClientRepositoryWithoutReleases

internal/registry/github/client_test.go:413–436  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

411}
412
413func TestClientRepositoryWithoutReleases(t *testing.T) {
414 t.Parallel()
415
416 server := newGitHubServer(t, func(writer http.ResponseWriter, request *http.Request) {
417 switch request.URL.Path {
418 case "/repos/acme/demo/releases/latest":
419 http.NotFound(writer, request)
420 case "/repos/acme/demo/releases":
421 writeJSON(writer, `[]`)
422 default:
423 http.NotFound(writer, request)
424 }
425 })
426 defer server.Close()
427
428 client := NewClient(server.URL)
429 _, err := client.Info(context.Background(), "acme/demo")
430 if err == nil {
431 t.Fatal("Info() error = nil, want no releases failure")
432 }
433 if !strings.Contains(err.Error(), "no published releases") {
434 t.Fatalf("Info() error = %v, want no releases message", err)
435 }
436}
437
438func TestClientFallsBackToFirstPublishedReleaseWhenLatestEndpointIsMissing(t *testing.T) {
439 t.Parallel()

Callers

nothing calls this directly

Calls 7

InfoMethod · 0.95
newGitHubServerFunction · 0.85
ContainsMethod · 0.80
writeJSONFunction · 0.70
NewClientFunction · 0.70
CloseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected