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

Function TestManager_Upgrade_NoMatchingExtension

pkg/cmd/extension/manager_test.go:301–317  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

299}
300
301func TestManager_Upgrade_NoMatchingExtension(t *testing.T) {
302 dataDir := t.TempDir()
303 updateDir := t.TempDir()
304 extDir := filepath.Join(dataDir, "extensions", "gh-hello")
305 assert.NoError(t, stubExtension(filepath.Join(dataDir, "extensions", "gh-hello", "gh-hello")))
306 ios, _, stdout, stderr := iostreams.Test()
307 gc, gcOne := &mockGitClient{}, &mockGitClient{}
308 gc.On("ForRepo", extDir).Return(gcOne).Once()
309
310 m := newTestManager(dataDir, updateDir, nil, gc, ios)
311 err := m.Upgrade("invalid", false)
312 assert.EqualError(t, err, `no extension matched "invalid"`)
313 assert.Equal(t, "", stdout.String())
314 assert.Equal(t, "", stderr.String())
315 gc.AssertExpectations(t)
316 gcOne.AssertExpectations(t)
317}
318
319func TestManager_UpgradeExtensions(t *testing.T) {
320 dataDir := t.TempDir()

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
stubExtensionFunction · 0.85
newTestManagerFunction · 0.85
JoinMethod · 0.80
EqualMethod · 0.80
UpgradeMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected