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

Function TestManager_Remove

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

Source from the content-addressed store, hash-verified

268}
269
270func TestManager_Remove(t *testing.T) {
271 dataDir := t.TempDir()
272 updateDir := t.TempDir()
273 assert.NoError(t, stubExtension(filepath.Join(dataDir, "extensions", "gh-hello", "gh-hello")))
274 assert.NoError(t, stubExtensionUpdate(filepath.Join(updateDir, "gh-hello")))
275 assert.NoError(t, stubExtension(filepath.Join(dataDir, "extensions", "gh-two", "gh-two")))
276
277 m := newTestManager(dataDir, updateDir, nil, nil, nil)
278 err := m.Remove("hello")
279 assert.NoError(t, err)
280
281 items, err := os.ReadDir(filepath.Join(dataDir, "extensions"))
282 assert.NoError(t, err)
283 assert.Equal(t, 1, len(items))
284 assert.Equal(t, "gh-two", items[0].Name())
285
286 assert.NoDirExistsf(t, filepath.Join(updateDir, "gh-hello"), "update directory should be removed")
287}
288
289func TestManager_Upgrade_NoExtensions(t *testing.T) {
290 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