MCPcopy Create free account
hub / github.com/cli/cli / TestBrowseModelFiltersExtensions

Function TestBrowseModelFiltersExtensions

pkg/cmd/extension/browse/model_test.go:199–218  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

197}
198
199func TestBrowseModelFiltersExtensions(t *testing.T) {
200 t.Parallel()
201
202 // Given a catalog with extensions that have different names and descriptions
203 model := newBrowseModel(ExtBrowseOpts{}, []extEntry{
204 {FullName: "cli/gh-cool", description: "terminal tools"},
205 {FullName: "octo/gh-triage", description: "issue management"},
206 })
207
208 // When the user focuses the filter and enters cool
209 updateBrowseModel(t, model, keyPress('/'))
210 for _, r := range "cool" {
211 updateBrowseModel(t, model, keyPress(r))
212 }
213
214 // Then only the matching extension is displayed
215 view := model.View().Content
216 assert.Contains(t, view, "cli/gh-cool")
217 assert.NotContains(t, view, "octo/gh-triage")
218}
219
220func TestBrowseModelFiltersExtensionsByDisplayedStatus(t *testing.T) {
221 t.Parallel()

Callers

nothing calls this directly

Calls 5

newBrowseModelFunction · 0.85
updateBrowseModelFunction · 0.85
keyPressFunction · 0.85
ContainsMethod · 0.80
ViewMethod · 0.65

Tested by

no test coverage detected