test: consolidate Go tests (#39962)

Consolidate all Go tests. Coverage is identical to before. Go tests are
around 5% faster while being 7% smaller. No non-test code is touched.
This commit is contained in:
silverwind authored and GitHub committed 2026-10-24 13:48:19 +00:00
1 parent ce7364e215
commit 8abda62312
388 files changed
+18410 -29561

No files matched your search

+7 -14
View File
@@ -117,19 +117,19 @@ description: ` + packageDescription,
uploadFile(t, result.URL, buildPackage(packageVersionLatest), http.StatusNoContent)
})
type VersionMetadata struct {
Version string `json:"version"`
ArchiveURL string `json:"archive_url"`
Published time.Time `json:"published"`
Pubspec any `json:"pubspec,omitempty"`
}
t.Run("Download", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
req := NewRequest(t, "GET", fmt.Sprintf("%s/api/packages/%s/%s", root, packageName, packageVersion))
resp := MakeRequest(t, req, http.StatusOK)
type VersionMetadata struct {
Version string `json:"version"`
ArchiveURL string `json:"archive_url"`
Published time.Time `json:"published"`
Pubspec any `json:"pubspec,omitempty"`
}
result := DecodeJSON(t, resp, &VersionMetadata{})
assert.Equal(t, packageVersion, result.Version)
@@ -147,13 +147,6 @@ description: ` + packageDescription,
req := NewRequest(t, "GET", fmt.Sprintf("%s/api/packages/%s", root, packageName))
resp := MakeRequest(t, req, http.StatusOK)
type VersionMetadata struct {
Version string `json:"version"`
ArchiveURL string `json:"archive_url"`
Published time.Time `json:"published"`
Pubspec any `json:"pubspec,omitempty"`
}
type PackageVersions struct {
Name string `json:"name"`
Latest *VersionMetadata `json:"latest"`