Skip to content

Commit 848aa33

Browse files
authored
minor fixes (#178)
1 parent 1e5a045 commit 848aa33

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/middleware/rateLimiter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const redis = require('../../config/redis')
22
const redisClient = redis.redisClient
33
const moment = require('moment')
44
const WINDOW_SIZE_IN_HOURS = 24
5-
const MAX_WINDOW_REQUEST_COUNT = process.env.NODE_ENV === 'testing' ? 20 : 100
5+
const MAX_WINDOW_REQUEST_COUNT = process.env.NODE_ENV === 'testing' ? 20 : 500
66
const WINDOW_LOG_INTERVAL_IN_HOURS = 1
77

88
module.exports = {

test/organisation.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const HttpStatus = require('http-status-codes')
55
const Organization = require('../app/models/Organisation')
66
const User = require('../app/models/User')
77
const jwt = require('jsonwebtoken')
8+
const redis = require('../config/redis').redisClient
89
const adminId = new mongoose.Types.ObjectId()
910
const moderatorId = new mongoose.Types.ObjectId()
1011
const randomDigit = Math.floor(Math.random() * 90 + 10)
@@ -107,6 +108,7 @@ let server
107108
*/
108109
beforeAll(async (done) => {
109110
await Organization.deleteMany()
111+
await redis.flushall()
110112
await new User(testUser).save()
111113
server = app.listen(4000, () => {
112114
global.agent = request.agent(server)
@@ -272,6 +274,8 @@ afterAll(async () => {
272274
await Organization.deleteMany()
273275
// delete all the user created
274276
await User.deleteMany()
277+
// flush redis
278+
await redis.flushall()
275279
// Closing the DB connection allows Jest to exit successfully.
276280
await mongoose.connection.close()
277281
})

0 commit comments

Comments
 (0)