Files
vim-ale/internal/releases/node/node_test.go
T
AJ ONeal 6fd248a4ac fix(webicached): add --tags to git fetch and modernize Go string ops
Bug fix:
- gittag: git fetch without --tags misses tags not reachable from
  any branch, causing stale version lists.

Modern Go (Go 1.24+):
- strings.SplitSeq instead of strings.Split for iteration
- strings.Cut/CutPrefix/CutSuffix instead of Index/HasPrefix/TrimSuffix
- min() builtin instead of manual min logic

Fix:
- node_test: pass required baseURL argument to nodedist.Fetch
2026-08-19 17:24:44 -06:00

37 lines
786 B
Go

package nodedist_test
import (
"context"
"net/http"
"testing"
"github.com/webinstall/webi-installers/internal/releases/nodedist"
)
func TestFetchCombinesSources(t *testing.T) {
if testing.Short() {
t.Skip("skipping network test in short mode")
}
ctx := context.Background()
client := &http.Client{}
var batches int
var total int
for entries, err := range nodedist.Fetch(ctx, client, "https://nodejs.org/download/release") {
if err != nil {
t.Fatalf("batch %d: %v", batches, err)
}
batches++
total += len(entries)
}
if batches != 1 {
t.Errorf("got %d batches, want 2 (official + unofficial)", batches)
}
if total < 100 {
t.Errorf("got %d total entries, expected at least 100", total)
}
t.Logf("fetched %d entries in %d batches", total, batches)
}