fix: npm route (#39488)

This commit is contained in:
wxiaoguang
2026-09-30 19:49:50 +08:00
committed by GitHub
parent a25fbd43c4
commit cc95f141f8
5 changed files with 47 additions and 49 deletions
+4 -3
View File
@@ -170,8 +170,9 @@ func TestPackageNpm(t *testing.T) {
defer tests.PrintCurrentTest(t)()
rootPaths := []string{
fmt.Sprintf("/api/packages/%s/npm/@scope/test-package", user.Name),
fmt.Sprintf("/api/packages/%s/npm/@scope%%2ftest-package", user.Name),
"/api/packages/user2/npm/@scope/test-package",
"/api/packages/user2/npm/@scope%2Ftest-package",
"/api/packages/user2/npm/%40scope%2ftest-package",
}
for _, root := range rootPaths {
req := NewRequest(t, "GET", fmt.Sprintf("%s/-/%s/%s", root, packageVersion, filename)).AddTokenAuth(token)
@@ -186,7 +187,7 @@ func TestPackageNpm(t *testing.T) {
pvs, err := packages.GetVersionsByPackageType(t.Context(), user.ID, packages.TypeNpm)
assert.NoError(t, err)
assert.Len(t, pvs, 1)
assert.Equal(t, int64(4), pvs[0].DownloadCount)
assert.EqualValues(t, 6, pvs[0].DownloadCount)
})
t.Run("PackageMetadata", func(t *testing.T) {