31 lines
724 B
Go
31 lines
724 B
Go
package api
|
|
|
|
import "testing"
|
|
|
|
func TestServerCookieName(t *testing.T) {
|
|
t.Parallel()
|
|
tests := []struct {
|
|
name string
|
|
secure bool
|
|
expected string
|
|
}{
|
|
{name: "local development", secure: false, expected: "zpa_session"},
|
|
{name: "secure deployment", secure: true, expected: "__Host-zpa_session"},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
server := &Server{cookieSecure: tt.secure}
|
|
if got := server.cookieName(); got != tt.expected {
|
|
t.Fatalf("cookieName() = %q, want %q", got, tt.expected)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestPersianStatus(t *testing.T) {
|
|
t.Parallel()
|
|
if got := persianStatus("Verified"); got != "تأیید شده" {
|
|
t.Fatalf("persianStatus() = %q", got)
|
|
}
|
|
}
|