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