(t *testing.T)
| 268 | } |
| 269 | |
| 270 | func 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 | |
| 289 | func TestManager_Upgrade_NoExtensions(t *testing.T) { |
| 290 | dataDir := t.TempDir() |
nothing calls this directly
no test coverage detected