mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-01 21:10:13 +00:00
test: expand backend coverage
This commit is contained in:
parent
3ea5f54d93
commit
7f7edfceb4
118 changed files with 21980 additions and 74 deletions
33
internal/models/organization_additional_test.go
Normal file
33
internal/models/organization_additional_test.go
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package models
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestOrganizationAccessors(t *testing.T) {
|
||||
org := &Organization{
|
||||
ID: "org-1",
|
||||
OwnerUserID: "owner",
|
||||
Members: []OrganizationMember{
|
||||
{UserID: "admin", Role: OrgRoleAdmin},
|
||||
{UserID: "member", Role: OrgRoleMember},
|
||||
},
|
||||
}
|
||||
|
||||
if !org.HasMember("admin") || org.HasMember("missing") {
|
||||
t.Fatalf("HasMember results unexpected")
|
||||
}
|
||||
if role := org.GetMemberRole("admin"); role != OrgRoleAdmin {
|
||||
t.Fatalf("GetMemberRole = %q, want admin", role)
|
||||
}
|
||||
if role := org.GetMemberRole("missing"); role != "" {
|
||||
t.Fatalf("GetMemberRole for missing = %q, want empty", role)
|
||||
}
|
||||
if !org.IsOwner("owner") || org.IsOwner("admin") {
|
||||
t.Fatalf("IsOwner results unexpected")
|
||||
}
|
||||
if !org.CanUserAccess("owner") || !org.CanUserAccess("member") || org.CanUserAccess("missing") {
|
||||
t.Fatalf("CanUserAccess results unexpected")
|
||||
}
|
||||
if !org.CanUserManage("owner") || !org.CanUserManage("admin") || org.CanUserManage("member") {
|
||||
t.Fatalf("CanUserManage results unexpected")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue