package client import "testing" func TestPrivilege_IsValid(t *testing.T) { tests := []struct { name string e Privilege want bool }{ { name: "Admin", e: "ADMIN", want: true, }, { name: "Company", e: "COMPANY", want: true, }, { name: "Consumer", e: "CONSUMER", want: true, }, { name: "Time", e: "TIME", want: true, }, { name: "Invoicing", e: "INVOICING", want: true, }, { name: "Accounting", e: "ACCOUNTING", want: true, }, { name: "Supplier", e: "SUPPLIER", want: true, }, { name: "Invalid", e: "BLUTTI", want: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.e.IsValid(); got != tt.want { t.Errorf("IsValid() = %v, want %v", got, tt.want) } }) } } func TestPrivilege_String(t *testing.T) { tests := []struct { name string e Privilege want string }{ { name: "Admin", e: "ADMIN", want: "ADMIN", }, { name: "Company", e: "COMPANY", want: "COMPANY", }, { name: "Consumer", e: "CONSUMER", want: "CONSUMER", }, { name: "Time", e: "TIME", want: "TIME", }, { name: "Invoicing", e: "INVOICING", want: "INVOICING", }, { name: "Accounting", e: "ACCOUNTING", want: "ACCOUNTING", }, { name: "Supplier", e: "SUPPLIER", want: "SUPPLIER", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.e.String(); got != tt.want { t.Errorf("String() = %v, want %v", got, tt.want) } }) } }