RezinaLMS-BackEnd/internal/domain/content_access_tier_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

25 lines
951 B
Go

package domain
import "testing"
func TestEffectiveContentAccessTier(t *testing.T) {
if got := EffectiveContentAccessTier(ContentAccessFree, ContentAccessFree); got != ContentAccessFree {
t.Fatalf("expected FREE, got %s", got)
}
if got := EffectiveContentAccessTier(ContentAccessFree, ContentAccessPremium); got != ContentAccessPremium {
t.Fatalf("expected PREMIUM, got %s", got)
}
if got := EffectiveContentAccessTier(ContentAccessPremium, ContentAccessFree); got != ContentAccessPremium {
t.Fatalf("expected cascaded PREMIUM, got %s", got)
}
}
func TestContentAccessTierForRole_openLearnerAlwaysFree(t *testing.T) {
if got := ContentAccessTierForRole(RoleOpenLearner, ContentAccessPremium); got != ContentAccessFree {
t.Fatalf("OPEN_LEARNER expected FREE, got %s", got)
}
if got := ContentAccessTierForRole(RoleStudent, ContentAccessPremium); got != ContentAccessPremium {
t.Fatalf("STUDENT expected PREMIUM, got %s", got)
}
}