(t *testing.T)
| 591 | } |
| 592 | |
| 593 | func TestBrowseModelShowsBrowserFailure(t *testing.T) { |
| 594 | t.Parallel() |
| 595 | |
| 596 | // Given the selected extension repository cannot be opened in a browser |
| 597 | browser := &browserStub{err: errors.New("browser unavailable")} |
| 598 | model := newBrowseModel(ExtBrowseOpts{ |
| 599 | Browser: browser, |
| 600 | }, []extEntry{ |
| 601 | { |
| 602 | FullName: "cli/gh-cool", |
| 603 | URL: "https://github.com/cli/gh-cool", |
| 604 | }, |
| 605 | }) |
| 606 | |
| 607 | // When the user presses w and the browser command completes |
| 608 | cmd := updateBrowseModel(t, model, keyPress('w')) |
| 609 | require.NotNil(t, cmd) |
| 610 | updateBrowseModel(t, model, cmd()) |
| 611 | |
| 612 | // Then the attempted URL and visible failure identify the selected extension |
| 613 | assert.Equal(t, "https://github.com/cli/gh-cool", browser.url) |
| 614 | assert.Contains(t, model.View().Content, "could not open browser for 'https://github.com/cli/gh-cool'") |
| 615 | } |
| 616 | |
| 617 | func TestBrowseModelClearsTransientStatusOnNextInteraction(t *testing.T) { |
| 618 | t.Parallel() |
nothing calls this directly
no test coverage detected