Every call shared one SDK client whose context was background, so no caller could cancel a Gitea request; each call now binds its own. LinkBranch hand-built JSON over raw HTTP and posted to an endpoint Gitea does not have; it sets the issue's ref through the SDK. PRState and VerifyPush matched error text instead of the status, label lookup stopped at the first 100 labels, merges ignored the repository's merge style, and a review of the token's own pull request requested changes Gitea refuses.
20 lines
708 B
Go
20 lines
708 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/samcharles93/archipelago/sdk/forge"
|
|
)
|
|
|
|
func TestReviewEvent(t *testing.T) {
|
|
for _, tc := range []struct{ name, event, author, self, want string }{
|
|
{"own pull request comments", forge.ReviewEventRequestChanges, "archie", "Archie", forge.ReviewEventComment},
|
|
{"someone else's pull request requests changes", forge.ReviewEventRequestChanges, "alice", "archie", forge.ReviewEventRequestChanges},
|
|
{"unknown author requests changes", forge.ReviewEventRequestChanges, "", "archie", forge.ReviewEventRequestChanges},
|
|
} {
|
|
if got := reviewEvent(tc.event, tc.author, tc.self); got != tc.want {
|
|
t.Errorf("%s: got %q, want %q", tc.name, got, tc.want)
|
|
}
|
|
}
|
|
}
|