Files
descrybe/apps/api/cmd/migrator/postimport_test.go
T
greeneclipse 8580c996c3 Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
2026-08-09 22:47:43 +02:00

34 lines
829 B
Go

package main
import (
"context"
"os"
"strings"
"testing"
)
func TestSetPasswordInviteURL(t *testing.T) {
t.Setenv("WEB_ORIGIN", "https://app.example.com/")
got := setPasswordInviteURL("tok+1")
wantPrefix := "https://app.example.com/accept-invite?token="
if !strings.HasPrefix(got, wantPrefix) {
t.Fatalf("got %q", got)
}
if !strings.Contains(got, "tok%2B1") && !strings.Contains(got, "tok+1") {
t.Fatalf("token not in URL: %q", got)
}
}
func TestSetPasswordByEmailParse(t *testing.T) {
err := setPasswordByEmail(context.TODO(), nil, "bad")
if err == nil || !strings.Contains(err.Error(), "email:password") {
t.Fatalf("expected parse error, got %v", err)
}
}
func TestWebOriginDefault(t *testing.T) {
os.Unsetenv("WEB_ORIGIN")
if webOrigin() != "http://localhost:5174" {
t.Fatalf("default origin")
}
}