MCPcopy
hub / github.com/cli/cli / TestManager_Upgrade_NoMatchingExtension

Function TestManager_Upgrade_NoMatchingExtension

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

Source from the content-addressed store, hash-verified

223}
224
225func TestManager_Upgrade_NoMatchingExtension(t *testing.T) {
226 dataDir := t.TempDir()
227 updateDir := t.TempDir()
228 extDir := filepath.Join(dataDir, "extensions", "gh-hello")
229 assert.NoError(t, stubExtension(filepath.Join(dataDir, "extensions", "gh-hello", "gh-hello")))
230 ios, _, stdout, stderr := iostreams.Test()
231 gc, gcOne := &mockGitClient{}, &mockGitClient{}
232 gc.On("ForRepo", extDir).Return(gcOne).Once()
233
234 m := newTestManager(dataDir, updateDir, nil, gc, ios)
235 err := m.Upgrade("invalid", false)
236 assert.EqualError(t, err, `no extension matched "invalid"`)
237 assert.Equal(t, "", stdout.String())
238 assert.Equal(t, "", stderr.String())
239 gc.AssertExpectations(t)
240 gcOne.AssertExpectations(t)
241}
242
243func TestManager_UpgradeExtensions(t *testing.T) {
244 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.45

Tested by

no test coverage detected