update tests

This commit is contained in:
pat-s
2024-12-06 10:34:05 +01:00
parent 6396701222
commit 80ed91ff70
6 changed files with 55 additions and 11 deletions

View File

@@ -136,7 +136,7 @@ func Test_parse(t *testing.T) {
g.Assert(pipeline.Commit).Equal(hook.PullRequest.Head.Sha)
g.Assert(pipeline.Ref).Equal("refs/pull/1/head")
g.Assert(pipeline.ForgeURL).Equal("http://forgejo.golang.org/gordon/hello-world/pull/1")
g.Assert(pipeline.Branch).Equal("main")
g.Assert(pipeline.Branch).Equal("feature/changes")
g.Assert(pipeline.Refspec).Equal("feature/changes:main")
g.Assert(pipeline.Message).Equal(hook.PullRequest.Title)
g.Assert(pipeline.Avatar).Equal("http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87")

View File

@@ -207,7 +207,7 @@ func TestForgejoParser(t *testing.T) {
Author: "gordon",
Event: "pull_request",
Commit: "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c",
Branch: "main",
Branch: "feature/changes",
Ref: "refs/pull/1/head",
Refspec: "feature/changes:main",
Title: "Update the README with new information",
@@ -246,7 +246,7 @@ func TestForgejoParser(t *testing.T) {
Author: "test",
Event: "pull_request",
Commit: "788ed8d02d3b7fcfcf6386dbcbca696aa1d4dc25",
Branch: "main",
Branch: "test-patch-1",
Ref: "refs/pull/2/head",
Refspec: "test-patch-1:main",
Title: "New Pull",
@@ -287,7 +287,7 @@ func TestForgejoParser(t *testing.T) {
Author: "anbraten",
Event: "pull_request_closed",
Commit: "d555a5dd07f4d0148a58d4686ec381502ae6a2d4",
Branch: "main",
Branch: "anbraten-patch-1",
Ref: "refs/pull/1/head",
Refspec: "anbraten-patch-1:main",
Title: "Adjust file",
@@ -325,7 +325,7 @@ func TestForgejoParser(t *testing.T) {
Author: "anbraten",
Event: "pull_request_closed",
Commit: "d555a5dd07f4d0148a58d4686ec381502ae6a2d4",
Branch: "main",
Branch: "anbraten-patch-1",
Ref: "refs/pull/1/head",
Refspec: "anbraten-patch-1:main",
Title: "Adjust file",

View File

@@ -137,7 +137,7 @@ func Test_parse(t *testing.T) {
g.Assert(pipeline.Commit).Equal(hook.PullRequest.Head.Sha)
g.Assert(pipeline.Ref).Equal("refs/pull/1/head")
g.Assert(pipeline.ForgeURL).Equal("http://gitea.golang.org/gordon/hello-world/pull/1")
g.Assert(pipeline.Branch).Equal("main")
g.Assert(pipeline.Branch).Equal("feature/changes")
g.Assert(pipeline.Refspec).Equal("feature/changes:main")
g.Assert(pipeline.Message).Equal(hook.PullRequest.Title)
g.Assert(pipeline.Avatar).Equal("http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87")

View File

@@ -208,7 +208,7 @@ func TestGiteaParser(t *testing.T) {
Author: "gordon",
Event: "pull_request",
Commit: "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c",
Branch: "main",
Branch: "feature/changes",
Ref: "refs/pull/1/head",
Refspec: "feature/changes:main",
Title: "Update the README with new information",
@@ -247,7 +247,7 @@ func TestGiteaParser(t *testing.T) {
Author: "test",
Event: "pull_request",
Commit: "788ed8d02d3b7fcfcf6386dbcbca696aa1d4dc25",
Branch: "main",
Branch: "test-patch-1",
Ref: "refs/pull/2/head",
Refspec: "test-patch-1:main",
Title: "New Pull",
@@ -288,7 +288,7 @@ func TestGiteaParser(t *testing.T) {
Author: "anbraten",
Event: "pull_request_closed",
Commit: "d555a5dd07f4d0148a58d4686ec381502ae6a2d4",
Branch: "main",
Branch: "anbraten-patch-1",
Ref: "refs/pull/1/head",
Refspec: "anbraten-patch-1:main",
Title: "Adjust file",
@@ -326,7 +326,7 @@ func TestGiteaParser(t *testing.T) {
Author: "anbraten",
Event: "pull_request_closed",
Commit: "d555a5dd07f4d0148a58d4686ec381502ae6a2d4",
Branch: "main",
Branch: "anbraten-patch-1",
Ref: "refs/pull/1/head",
Refspec: "anbraten-patch-1:main",
Title: "Adjust file",

View File

@@ -209,7 +209,7 @@ func Test_helper(t *testing.T) {
g.Assert(err).IsNil()
g.Assert(pull).IsNotNil()
g.Assert(pipeline.Event).Equal(model.EventPull)
g.Assert(pipeline.Branch).Equal(*from.PullRequest.Base.Ref)
g.Assert(pipeline.Branch).Equal(*from.PullRequest.Head.Ref)
g.Assert(pipeline.Ref).Equal("refs/pull/42/merge")
g.Assert(pipeline.Refspec).Equal("changes:main")
g.Assert(pipeline.Commit).Equal(*from.PullRequest.Head.SHA)