mirror of
https://github.com/go-gitea/gitea
synced 2025-08-01 15:18:37 +00:00
Fix package error handling and npm meta and empty repo guide (#33112)
This commit is contained in:
@@ -52,24 +52,33 @@ func TestPackageNpm(t *testing.T) {
|
||||
"` + packageTag + `": "` + version + `"
|
||||
},
|
||||
"versions": {
|
||||
"` + version + `": {
|
||||
"name": "` + packageName + `",
|
||||
"version": "` + version + `",
|
||||
"description": "` + packageDescription + `",
|
||||
"author": {
|
||||
"name": "` + packageAuthor + `"
|
||||
},
|
||||
"bin": {
|
||||
"` + packageBinName + `": "` + packageBinPath + `"
|
||||
},
|
||||
"dist": {
|
||||
"integrity": "sha512-yA4FJsVhetynGfOC1jFf79BuS+jrHbm0fhh+aHzCQkOaOBXKf9oBnC4a6DnLLnEsHQDRLYd00cwj8sCXpC+wIg==",
|
||||
"shasum": "aaa7eaf852a948b0aa05afeda35b1badca155d90"
|
||||
},
|
||||
"repository": {
|
||||
"type": "` + repoType + `",
|
||||
"url": "` + repoURL + `"
|
||||
}
|
||||
"` + version + `": {
|
||||
"name": "` + packageName + `",
|
||||
"version": "` + version + `",
|
||||
"description": "` + packageDescription + `",
|
||||
"author": {
|
||||
"name": "` + packageAuthor + `"
|
||||
},
|
||||
"bin": {
|
||||
"` + packageBinName + `": "` + packageBinPath + `"
|
||||
},
|
||||
"dist": {
|
||||
"integrity": "sha512-yA4FJsVhetynGfOC1jFf79BuS+jrHbm0fhh+aHzCQkOaOBXKf9oBnC4a6DnLLnEsHQDRLYd00cwj8sCXpC+wIg==",
|
||||
"shasum": "aaa7eaf852a948b0aa05afeda35b1badca155d90"
|
||||
},
|
||||
"repository": {
|
||||
"type": "` + repoType + `",
|
||||
"url": "` + repoURL + `"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tea": "2.x",
|
||||
"soy-milk": "1.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"soy-milk": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"_attachments": {
|
||||
@@ -178,6 +187,8 @@ func TestPackageNpm(t *testing.T) {
|
||||
assert.Equal(t, fmt.Sprintf("%s%s/-/%s/%s", setting.AppURL, root[1:], packageVersion, filename), pmv.Dist.Tarball)
|
||||
assert.Equal(t, repoType, result.Repository.Type)
|
||||
assert.Equal(t, repoURL, result.Repository.URL)
|
||||
assert.Equal(t, map[string]string{"tea": "2.x", "soy-milk": "1.2"}, pmv.PeerDependencies)
|
||||
assert.Equal(t, map[string]any{"soy-milk": map[string]any{"optional": true}}, pmv.PeerDependenciesMeta)
|
||||
})
|
||||
|
||||
t.Run("AddTag", func(t *testing.T) {
|
||||
|
@@ -58,8 +58,12 @@ func TestEmptyRepoAddFile(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
session := loginUser(t, "user30")
|
||||
req := NewRequest(t, "GET", "/user30/empty/_new/"+setting.Repository.DefaultBranch)
|
||||
req := NewRequest(t, "GET", "/user30/empty")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Contains(t, resp.Body.String(), "empty-repo-guide")
|
||||
|
||||
req = NewRequest(t, "GET", "/user30/empty/_new/"+setting.Repository.DefaultBranch)
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
doc := NewHTMLParser(t, resp.Body).Find(`input[name="commit_choice"]`)
|
||||
assert.Empty(t, doc.AttrOr("checked", "_no_"))
|
||||
req = NewRequestWithValues(t, "POST", "/user30/empty/_new/"+setting.Repository.DefaultBranch, map[string]string{
|
||||
|
Reference in New Issue
Block a user