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

Function TestCheckDomainCreate_BlocksAtCap

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

Source from the content-addressed store, hash-verified

179}
180
181func TestCheckDomainCreate_BlocksAtCap(t *testing.T) {
182 store := &fakeStore{found: true, row: Limits{MaxAgents: 100, MaxDomains: 1, MaxMessagesMonth: 1, MaxStorageBytes: 1}}
183 counter := &fakeCounter{domains: 1}
184 e := newEnforcerWithReader(store, counter, defaultsForTest(), 0)
185
186 err := e.CheckDomainCreate(context.Background(), "user1")
187 le, ok := IsLimitExceeded(err)
188 if !ok {
189 t.Fatalf("CheckDomainCreate at cap = %v, want LimitExceededError", err)
190 }
191 if le.Resource != "domains" {
192 t.Errorf("Resource = %q, want domains", le.Resource)
193 }
194}
195
196func TestCheckMessageSend_BlocksOnMonthFlow(t *testing.T) {
197 store := &fakeStore{found: true, row: Limits{MaxAgents: 100, MaxDomains: 100, MaxMessagesMonth: 1000, MaxStorageBytes: 1 << 40}}

Callers

nothing calls this directly

Calls 4

newEnforcerWithReaderFunction · 0.85
defaultsForTestFunction · 0.85
IsLimitExceededFunction · 0.85
CheckDomainCreateMethod · 0.65

Tested by

no test coverage detected