MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestEnforcer_GetFallsBackToDefaultsWhenNoRow

Function TestEnforcer_GetFallsBackToDefaultsWhenNoRow

internal/limits/limits_test.go:74–92  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestEnforcer_GetFallsBackToDefaultsWhenNoRow(t *testing.T) {
75 store := &fakeStore{found: false}
76 counter := &fakeCounter{}
77 e := newEnforcerWithReader(store, counter, defaultsForTest(), 0)
78
79 got, err := e.Get(context.Background(), "user1")
80 if err != nil {
81 t.Fatalf("Get: %v", err)
82 }
83 if got.MaxAgents != 5 || got.MaxDomains != 2 || got.MaxMessagesMonth != 100 || got.MaxStorageBytes != 10_000 {
84 t.Errorf("Get fallback = %+v, want defaults", got)
85 }
86 if got.PlanCode != "default" {
87 t.Errorf("PlanCode = %q, want default", got.PlanCode)
88 }
89 if got.UpgradeURL != "" {
90 t.Errorf("UpgradeURL = %q on fallback, want empty", got.UpgradeURL)
91 }
92}
93
94func TestEnforcer_GetReturnsRowWhenPresent(t *testing.T) {
95 row := Limits{

Callers

nothing calls this directly

Calls 3

newEnforcerWithReaderFunction · 0.85
defaultsForTestFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected