MCPcopy
hub / github.com/cli/cli / Test_extList

Function Test_extList

pkg/cmd/extension/browse/browse_test.go:270–386  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

268}
269
270func Test_extList(t *testing.T) {
271 opts := ExtBrowseOpts{
272 Logger: log.New(io.Discard, "", 0),
273 Em: &extensions.ExtensionManagerMock{
274 InstallFunc: func(repo ghrepo.Interface, _ string) error {
275 assert.Equal(t, "cli/gh-cool", ghrepo.FullName(repo))
276 return nil
277 },
278 RemoveFunc: func(name string) error {
279 assert.Equal(t, "cool", name)
280 return nil
281 },
282 },
283 }
284 cmdFlex := tview.NewFlex()
285 app := tview.NewApplication()
286 list := tview.NewList()
287 pages := tview.NewPages()
288 ui := uiRegistry{
289 List: list,
290 App: app,
291 CmdFlex: cmdFlex,
292 Pages: pages,
293 }
294 extEntries := []extEntry{
295 {
296 Name: "gh-cool",
297 FullName: "cli/gh-cool",
298 Installed: false,
299 Official: true,
300 description: "it's just cool ok",
301 },
302 {
303 Name: "gh-screensaver",
304 FullName: "vilmibm/gh-screensaver",
305 Installed: true,
306 Official: false,
307 description: "animations in your terminal",
308 },
309 {
310 Name: "gh-triage",
311 FullName: "samcoe/gh-triage",
312 Installed: false,
313 Official: false,
314 description: "help with triage",
315 },
316 {
317 Name: "gh-gei",
318 FullName: "github/gh-gei",
319 Installed: true,
320 Official: true,
321 description: "something something enterprise",
322 },
323 }
324
325 extList := newExtList(opts, ui, extEntries)
326
327 extList.QueueUpdateDraw = func(f func()) *tview.Application {

Callers

nothing calls this directly

Calls 14

FullNameFunction · 0.92
newExtListFunction · 0.85
EqualMethod · 0.80
FilterMethod · 0.80
InstallSelectedMethod · 0.80
RefreshMethod · 0.80
RemoveSelectedMethod · 0.80
FindSelectedMethod · 0.80
ScrollDownMethod · 0.80
ScrollUpMethod · 0.80
PageDownMethod · 0.80
PageUpMethod · 0.80

Tested by

no test coverage detected