package installer import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // TestDownloadAndExtractEmptyURL verifies that an empty download URL (e.g. an // empty release manifest after a failed startup fetch) fails with a clear // error before any network attempt instead of a cryptic protocol error. func TestDownloadAndExtractEmptyURL(t *testing.T) { t.Run("empty url without command runner", func(t *testing.T) { err := DownloadAndExtract(nil, nil, "", t.TempDir(), "archive.7z", "") require.Error(t, err) assert.Contains(t, err.Error(), "release manifest unavailable or missing a download URL") }) t.Run("empty url with command runner", func(t *testing.T) { cr := NewCommandRunner(make(chan string, 10), nil) err := DownloadAndExtract(nil, cr, "", t.TempDir(), "archive.7z", "") require.Error(t, err) assert.Contains(t, err.Error(), "release manifest unavailable or missing a download URL") }) }