MCPcopy Create free account
hub / github.com/archlinux-de/pkgstats-cli / TestComplexGlobPatterns

Function TestComplexGlobPatterns

cmd/submit_test.go:110–135  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestComplexGlobPatterns(t *testing.T) {
111 if os.Getenv("INTEGRATION_TEST") == "1" {
112 t.Skip("Skipping complex glob patterns test in integration mode")
113 }
114
115 output, err := pkgstats(t, []string{"submit", "--dump-json"},
116 WithPkgBlocklist([]string{"app-[0-9]*.pkg"}),
117 WithMirrorBlocklist([]string{"*.example.co", "*.example.net"}),
118 WithMirror("http://mirror.example.co/archlinux/$repo/os/$arch"),
119 )
120 if err != nil {
121 t.Fatalf("Failed to run command: %v", err)
122 }
123
124 var request submit.Request
125 if err := json.Unmarshal([]byte(output), &request); err != nil {
126 t.Fatalf("Failed to unmarshal JSON: %v", err)
127 }
128
129 if request.Pacman.Mirror != "" {
130 t.Errorf("Expected pacman mirror to be empty, got %v", request.Pacman.Mirror)
131 }
132 if slices.Contains(request.Pacman.Packages, "app-123.pkg") {
133 t.Errorf("Expected pacman packages to not contain 'app-123.pkg'")
134 }
135}
136
137func TestSetQuietMode(t *testing.T) {
138 output, err := pkgstats(t, []string{"submit", "--quiet"})

Callers

nothing calls this directly

Calls 4

pkgstatsFunction · 0.85
WithPkgBlocklistFunction · 0.85
WithMirrorBlocklistFunction · 0.85
WithMirrorFunction · 0.85

Tested by

no test coverage detected