(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestClearCacheRun(t *testing.T) { |
| 14 | cacheDir := filepath.Join(t.TempDir(), "gh-cli-cache") |
| 15 | ios, _, stdout, stderr := iostreams.Test() |
| 16 | opts := &ClearCacheOptions{ |
| 17 | IO: ios, |
| 18 | CacheDir: cacheDir, |
| 19 | } |
| 20 | |
| 21 | if err := os.Mkdir(opts.CacheDir, 0600); err != nil { |
| 22 | assert.NoError(t, err) |
| 23 | } |
| 24 | |
| 25 | if err := clearCacheRun(opts); err != nil { |
| 26 | assert.NoError(t, err) |
| 27 | } |
| 28 | |
| 29 | assert.NoDirExistsf(t, opts.CacheDir, fmt.Sprintf("Cache dir: %s still exists", opts.CacheDir)) |
| 30 | assert.Equal(t, "✓ Cleared the cache\n", stdout.String()) |
| 31 | assert.Equal(t, "", stderr.String()) |
| 32 | } |
nothing calls this directly
no test coverage detected