RezinaLMS-BackEnd/internal/services/team/password_reset_test.go
Yared Yemane 815ac1576e feat: split learner OTP and team password-reset link flows
Learners get email/SMS OTP codes via /user/sendResetCode; team members get reset links via new /team/sendResetCode and /team/resetPassword APIs, with admin panel integration docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 01:52:49 -07:00

28 lines
828 B
Go

package team
import "testing"
func TestBuildTeamPasswordResetLink(t *testing.T) {
got := buildTeamPasswordResetLink("https://admin.example.com/reset-password", "a@b.com", "123456")
want := "https://admin.example.com/reset-password?email=a%40b.com&otp=123456"
if got != want {
t.Fatalf("got %q want %q", got, want)
}
}
func TestPasswordResetBaseURLFallback(t *testing.T) {
s := &Service{inviteBaseURL: "https://admin.example.com/accept-invite"}
got := s.passwordResetBaseURL()
want := "https://admin.example.com/reset-password"
if got != want {
t.Fatalf("got %q want %q", got, want)
}
s.passwordResetURL = "https://admin.example.com/forgot-password"
got = s.passwordResetBaseURL()
want = "https://admin.example.com/forgot-password"
if got != want {
t.Fatalf("explicit URL: got %q want %q", got, want)
}
}