Skip to content

test: cover rate limiter and pause guard#240

Open
pq198363-ops wants to merge 1 commit into
Agentpay-Org:mainfrom
pq198363-ops:bounty-44-ratelimit-pause-tests
Open

test: cover rate limiter and pause guard#240
pq198363-ops wants to merge 1 commit into
Agentpay-Org:mainfrom
pq198363-ops:bounty-44-ratelimit-pause-tests

Conversation

@pq198363-ops

Copy link
Copy Markdown

Summary

  • add dedicated protective middleware coverage in src/middleware.test.ts
  • cover the 60-request rate-limit boundary and the next-request 429 rate_limited response
  • assert Retry-After, message, and requestId on rate-limit failures
  • cover pause guard behavior for blocked writes, allowed GET/HEAD/OPTIONS reads, admin status, and unpause recovery

Closes #44

Validation

  • npx prettier --check src/middleware.test.ts
  • npm run lint
  • git diff --check
  • npm run build
  • $env:NODE_ENV='test'; node --test dist/middleware.test.js (2 tests, 1 suite)
  • clean dist, then npm run build
  • $env:NODE_ENV='test'; node --test dist/*.test.js dist/**/*.test.js (91 tests, 11 suites)

Notes

This is test-only. The rate-limit test temporarily enables runtime rate limiting within the focused test and restores NODE_ENV afterward, so the rest of the suite still uses the normal test environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test coverage for the rate limiter, pause guard, and 503 behaviour

1 participant