package httpapi import ( "testing" "botpontos/internal/domain" ) func TestIsRestricted(t *testing.T) { id := int64(7) cases := []struct { name string account domain.WebAccount want bool }{ {"leitura ligada a um usuário", domain.WebAccount{Role: domain.RoleViewer, UserID: &id}, true}, {"leitura sem vínculo", domain.WebAccount{Role: domain.RoleViewer}, false}, {"admin ligado a um usuário", domain.WebAccount{Role: domain.RoleAdmin, UserID: &id}, false}, {"owner ligado a um usuário", domain.WebAccount{Role: domain.RoleOwner, UserID: &id}, false}, } for _, c := range cases { if got := isRestricted(c.account); got != c.want { t.Errorf("%s: isRestricted = %v, esperado %v", c.name, got, c.want) } } }