MCPcopy Index your code
hub / github.com/cli/cli / TestManager_Remove

Function TestManager_Remove

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

Source from the content-addressed store, hash-verified

192}
193
194func TestManager_Remove(t *testing.T) {
195 dataDir := t.TempDir()
196 updateDir := t.TempDir()
197 assert.NoError(t, stubExtension(filepath.Join(dataDir, "extensions", "gh-hello", "gh-hello")))
198 assert.NoError(t, stubExtensionUpdate(filepath.Join(updateDir, "gh-hello")))
199 assert.NoError(t, stubExtension(filepath.Join(dataDir, "extensions", "gh-two", "gh-two")))
200
201 m := newTestManager(dataDir, updateDir, nil, nil, nil)
202 err := m.Remove("hello")
203 assert.NoError(t, err)
204
205 items, err := os.ReadDir(filepath.Join(dataDir, "extensions"))
206 assert.NoError(t, err)
207 assert.Equal(t, 1, len(items))
208 assert.Equal(t, "gh-two", items[0].Name())
209
210 assert.NoDirExistsf(t, filepath.Join(updateDir, "gh-hello"), "update directory should be removed")
211}
212
213func TestManager_Upgrade_NoExtensions(t *testing.T) {
214 dataDir := t.TempDir()

Callers

nothing calls this directly

Calls 7

stubExtensionFunction · 0.85
stubExtensionUpdateFunction · 0.85
newTestManagerFunction · 0.85
JoinMethod · 0.80
EqualMethod · 0.80
RemoveMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected