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

Function TestCheckMessageSend_BlocksOnMonthFlow

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

Source from the content-addressed store, hash-verified

194}
195
196func TestCheckMessageSend_BlocksOnMonthFlow(t *testing.T) {
197 store := &fakeStore{found: true, row: Limits{MaxAgents: 100, MaxDomains: 100, MaxMessagesMonth: 1000, MaxStorageBytes: 1 << 40}}
198 counter := &fakeCounter{messagesMonth: 1000, storageBytes: 0}
199 e := newEnforcerWithReader(store, counter, defaultsForTest(), 0)
200
201 err := e.CheckMessageSend(context.Background(), "user1")
202 le, ok := IsLimitExceeded(err)
203 if !ok {
204 t.Fatalf("CheckMessageSend at month cap = %v, want LimitExceededError", err)
205 }
206 if le.Resource != "messages" {
207 t.Errorf("Resource = %q, want messages", le.Resource)
208 }
209}
210
211func TestCheckMessageSend_BlocksOnStorage(t *testing.T) {
212 store := &fakeStore{found: true, row: Limits{MaxAgents: 100, MaxDomains: 100, MaxMessagesMonth: 1_000_000, MaxStorageBytes: 1024 * 1024}}

Callers

nothing calls this directly

Calls 4

newEnforcerWithReaderFunction · 0.85
defaultsForTestFunction · 0.85
IsLimitExceededFunction · 0.85
CheckMessageSendMethod · 0.65

Tested by

no test coverage detected