Skip to content

Commit

Permalink
Add tests to Idea domain
Browse files Browse the repository at this point in the history
Resolves #191
  • Loading branch information
gruz0 committed Nov 27, 2024
1 parent 783a932 commit abf6f4d
Show file tree
Hide file tree
Showing 42 changed files with 4,591 additions and 289 deletions.
11 changes: 7 additions & 4 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ export IDEA_SERVICE_API_BASE="http://localhost:3000/api"
# Used to interact with Concept API from the backend side.
export CONCEPT_SERVICE_API_BASE="http://localhost:3000/api"

# Maximum number of allowed requests per timeframe for creating ideas. Default: 5
export CREATE_IDEA_LIMITER_LIMIT=3
# Used to interact with Feedback API from the backend side.
export FEEDBACK_SERVICE_API_BASE="http://localhost:3000/api"

# Timeframe in seconds (1 hour window) for rate limits on creating ideas. Default: 3600
export CREATE_IDEA_LIMITER_TIMEFRAME=300
# Maximum number of allowed requests per timeframe for creating ideas. Default: 30.
export CREATE_IDEA_LIMITER_LIMIT=30

# Timeframe in seconds for rate limits on creating ideas. Default: 3600 seconds.
export CREATE_IDEA_LIMITER_TIMEFRAME=3600
23 changes: 23 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: 22.11.0
cache: npm

- run: npm install
- run: npm run test:coverage

- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage/lcov-report
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ redis-cli:
test: # Run test
@${NPM_RUN} test

.PHONY: coverage
coverage: # Run test coverage
@${NPM_RUN} test:coverage

#
# Production environment
#
Expand Down
Loading

0 comments on commit abf6f4d

Please sign in to comment.