30 lines
894 B
Go
30 lines
894 B
Go
package auth
|
|||
|
|
|
||
|
|
import "testing"
|
||
|
|
|
||
|
|
func TestDefaultOwnedCompanyName(t *testing.T) {
|
||
|
|
t.Parallel()
|
||
|
|
cases := []struct {
|
||
|
|
email, name, want string
|
||
|
|
}{
|
||
|
|
{email: "ada@example.com", name: "Ada", want: "Ada's workspace"},
|
||
|
|
{email: "ada@example.com", name: " ", want: "ada's workspace"},
|
||
|
|
{email: "ada@example.com", name: "", want: "ada's workspace"},
|
||
|
|
{email: "", name: "", want: "My workspace"},
|
||
|
|
{email: "nolsocal", name: "", want: "nolsocal's workspace"},
|
||
|
|
}
|
||
|
|
for _, tc := range cases {
|
||
|
|
got := defaultOwnedCompanyName(tc.email, tc.name)
|
||
|
|
if got != tc.want {
|
||
|
|
t.Fatalf("defaultOwnedCompanyName(%q, %q)=%q want %q", tc.email, tc.name, got, tc.want)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestInvitePasswordModeConstants(t *testing.T) {
|
||
|
|
t.Parallel()
|
||
|
|
if InvitePasswordSet != "set" || InvitePasswordVerify != "verify" || InvitePasswordRecover != "recover" {
|
||
|
|
t.Fatal("invite password mode constants drifted")
|
||
|
|
}
|
||
|
|
}
|