RezinaLMS-BackEnd/internal/domain/role_test.go
Yared Yemane 6b02a5a1fc Ensure OPEN_LEARNER bypasses subscription and sequential content locks.
Harden LMS and exam-prep gates so only STUDENT is enforced, and return FREE effective_access_tier for OPEN_LEARNER so clients do not show paywall locks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-14 02:38:00 -07:00

27 lines
737 B
Go

package domain
import "testing"
func TestRoleOpenLearnerBypassesSubscriptionAndSequentialLocks(t *testing.T) {
role := RoleOpenLearner
if !role.BypassesSubscription() {
t.Fatal("OPEN_LEARNER must bypass subscription gates")
}
if role.UsesLMSSequentialGating() {
t.Fatal("OPEN_LEARNER must not use sequential / precedence locking")
}
if !role.IsCustomerLearnerRole() {
t.Fatal("OPEN_LEARNER should be a customer learner role")
}
}
func TestRoleStudentKeepsSubscriptionAndSequentialLocks(t *testing.T) {
role := RoleStudent
if role.BypassesSubscription() {
t.Fatal("STUDENT must not bypass subscription gates")
}
if !role.UsesLMSSequentialGating() {
t.Fatal("STUDENT must use sequential / precedence locking")
}
}