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.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user