(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestManager_List(t *testing.T) { |
| 68 | dataDir := t.TempDir() |
| 69 | updateDir := t.TempDir() |
| 70 | assert.NoError(t, stubExtension(filepath.Join(dataDir, "extensions", "gh-hello", "gh-hello"))) |
| 71 | assert.NoError(t, stubExtension(filepath.Join(dataDir, "extensions", "gh-two", "gh-two"))) |
| 72 | |
| 73 | assert.NoError(t, stubBinaryExtension( |
| 74 | filepath.Join(dataDir, "extensions", "gh-bin-ext"), |
| 75 | binManifest{ |
| 76 | Owner: "owner", |
| 77 | Name: "gh-bin-ext", |
| 78 | Host: "example.com", |
| 79 | Tag: "v1.0.1", |
| 80 | })) |
| 81 | |
| 82 | dirOne := filepath.Join(dataDir, "extensions", "gh-hello") |
| 83 | dirTwo := filepath.Join(dataDir, "extensions", "gh-two") |
| 84 | gc, gcOne, gcTwo := &mockGitClient{}, &mockGitClient{}, &mockGitClient{} |
| 85 | gc.On("ForRepo", dirOne).Return(gcOne).Once() |
| 86 | gc.On("ForRepo", dirTwo).Return(gcTwo).Once() |
| 87 | |
| 88 | m := newTestManager(dataDir, updateDir, nil, gc, nil) |
| 89 | exts := m.List() |
| 90 | |
| 91 | assert.Equal(t, 3, len(exts)) |
| 92 | assert.Equal(t, "bin-ext", exts[0].Name()) |
| 93 | assert.Equal(t, "hello", exts[1].Name()) |
| 94 | assert.Equal(t, "two", exts[2].Name()) |
| 95 | gc.AssertExpectations(t) |
| 96 | gcOne.AssertExpectations(t) |
| 97 | gcTwo.AssertExpectations(t) |
| 98 | } |
| 99 | |
| 100 | func TestManager_list_includeMetadata(t *testing.T) { |
| 101 | dataDir := t.TempDir() |
nothing calls this directly
no test coverage detected