X Tutup
Skip to content

Commit ef08712

Browse files
author
vilmibm
committed
test list
1 parent 3971df4 commit ef08712

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

pkg/cmd/extension/manager_test.go

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,21 @@ func TestManager_List(t *testing.T) {
5959
assert.NoError(t, stubExtension(filepath.Join(tempDir, "extensions", "gh-hello", "gh-hello")))
6060
assert.NoError(t, stubExtension(filepath.Join(tempDir, "extensions", "gh-two", "gh-two")))
6161

62+
assert.NoError(t, stubBinaryExtension(
63+
filepath.Join(tempDir, "extensions", "gh-bin-ext"),
64+
binManifest{
65+
Owner: "owner",
66+
Name: "gh-bin-ext",
67+
Host: "example.com",
68+
Tag: "v1.0.1",
69+
}))
70+
6271
m := newTestManager(tempDir, nil, nil)
6372
exts := m.List(false)
64-
assert.Equal(t, 2, len(exts))
65-
assert.Equal(t, "hello", exts[0].Name())
66-
assert.Equal(t, "two", exts[1].Name())
67-
}
68-
69-
func TestManager_List_Binary(t *testing.T) {
70-
//tempDir := t.TempDir()
71-
// TODO
72-
73+
assert.Equal(t, 3, len(exts))
74+
assert.Equal(t, "bin-ext", exts[0].Name())
75+
assert.Equal(t, "hello", exts[1].Name())
76+
assert.Equal(t, "two", exts[2].Name())
7377
}
7478

7579
func TestManager_Dispatch(t *testing.T) {
@@ -212,13 +216,15 @@ func TestManager_Upgrade_BinaryExtension(t *testing.T) {
212216
reg := httpmock.Registry{}
213217
defer reg.Verify(t)
214218
client := http.Client{Transport: &reg}
215-
err := stubBinaryExtension(filepath.Join(tempDir, "extensions", "gh-bin-ext"), binManifest{
216-
Owner: "owner",
217-
Name: "gh-bin-ext",
218-
Host: "example.com",
219-
Tag: "v1.0.1",
220-
})
221-
assert.NoError(t, err)
219+
220+
assert.NoError(t, stubBinaryExtension(
221+
filepath.Join(tempDir, "extensions", "gh-bin-ext"),
222+
binManifest{
223+
Owner: "owner",
224+
Name: "gh-bin-ext",
225+
Host: "example.com",
226+
Tag: "v1.0.1",
227+
}))
222228

223229
m := newTestManager(tempDir, &client, io)
224230
reg.Register(
@@ -249,7 +255,7 @@ func TestManager_Upgrade_BinaryExtension(t *testing.T) {
249255
httpmock.REST("GET", "release/cool2"),
250256
httpmock.StringResponse("FAKE UPGRADED BINARY"))
251257

252-
err = m.Upgrade("bin-ext", false)
258+
err := m.Upgrade("bin-ext", false)
253259
assert.NoError(t, err)
254260

255261
manifest, err := os.ReadFile(filepath.Join(tempDir, "extensions/gh-bin-ext", manifestName))

0 commit comments

Comments
 (0)
X Tutup