-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rate limiter + unit tests + readme (#115)
This PR add tests for the Rate Limiter middleware, the main changes include: - [x] Updated README with steps and configs to run it locally - [x] Project Setup - [x] Running Tests - [x] Added Mocha, Chai and Sinon packages to run Unit Tests - [x] Rate Limiter - [x] Feature Flag (env variable) - [x] Fixes - [x] Rate Limiter middleware needs to be placed after the IPFS Parsed URL middleware, so we can access the CID - [x] Refactored the `import {version} from './package.json' to be set via task and imported as ENV variable, so we can easily tweak that in the tests and don't run into import issues - [x] Unit Tests - 1. Calls next handler if no auth token is provided and rate limit is not exceeded - 2. Throws an error if no auth token is provided and rate limit is exceeded - 3. Calls next handler if auth token is present but no token metadata is found and rate limit is not exceeded - 4. Throws an error if auth token is present but no token metadata is found and rate limit is exceeded - 5. Calls next handler if auth token is present and token metadata is invalid but rate limit is not exceeded - 6. Throws an error if auth token is present and token metadata is invalid and rate limit is exceeded - 7. Calls next handler if auth token is present and token metadata is valid - [x] Update Github Action to execute Unit Tests --------- Co-authored-by: Travis Vachon <[email protected]>
- Loading branch information
Showing
13 changed files
with
2,038 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
dist | ||
.mf | ||
.env | ||
.dev.vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.