feat(forge): HasWriteAccess and issue author in the github and gitea extensions (archie #1830)
publish / publish (push) Successful in 2m1s

This commit is contained in:
sam committed 2026-11-09 12:39:12 +11:00
1 parent 186916d632
commit a753d22e2b
10 files changed
+416 -135

No files matched your search

+22
View File
@@ -195,3 +195,25 @@ func TestCreateReviewCommentsSubmitsOneReview(t *testing.T) {
})
}
}
func TestCanWrite(t *testing.T) {
tests := []struct {
name, permission, role string
want bool
}{
{"admin", "admin", "admin", true},
{"write", "write", "write", true},
{"maintain by role", "write", "maintain", true},
{"read", "read", "read", false},
{"triage", "read", "triage", false},
{"none", "none", "", false},
{"empty", "", "", false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := canWrite(tt.permission, tt.role); got != tt.want {
t.Errorf("canWrite(%q, %q) = %v, want %v", tt.permission, tt.role, got, tt.want)
}
})
}
}