MCPcopy Create free account
hub / github.com/cli/cli / TestManager_Install_local_no_executable_found

Function TestManager_Install_local_no_executable_found

pkg/cmd/extension/manager_test.go:874–897  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

872}
873
874func TestManager_Install_local_no_executable_found(t *testing.T) {
875 dataDir := t.TempDir()
876 updateDir := t.TempDir()
877 ios, _, stdout, stderr := iostreams.Test()
878 m := newTestManager(dataDir, updateDir, nil, nil, ios)
879 fakeExtensionName := "gh-local-ext"
880
881 // Create a temporary directory to simulate the local extension repo
882 localDir := filepath.Join(dataDir, fakeExtensionName)
883 require.NoError(t, os.MkdirAll(localDir, 0755))
884
885 // Create a temporary directory to simulate the local extension update state
886 extensionUpdatePath := filepath.Join(updateDir, fakeExtensionName)
887 require.NoError(t, stubExtensionUpdate(extensionUpdatePath))
888
889 // Intentionally not creating an executable in the local extension repo
890 // to simulate an attempt to install a local extension without an executable
891
892 err := m.InstallLocal(localDir)
893 require.ErrorAs(t, err, new(*ErrExtensionExecutableNotFound))
894 assert.Equal(t, "", stdout.String())
895 assert.Equal(t, "", stderr.String())
896 require.NoDirExistsf(t, extensionUpdatePath, "update directory should be removed")
897}
898
899func TestManager_Install_git(t *testing.T) {
900 dataDir := t.TempDir()

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
newTestManagerFunction · 0.85
stubExtensionUpdateFunction · 0.85
JoinMethod · 0.80
EqualMethod · 0.80
InstallLocalMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected