Skip to content

Commit 5f3e49e

Browse files
committed
fix: clear rate limit key before each rate limiting test
1 parent 236a70c commit 5f3e49e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

__tests__/comments.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,12 @@ describe('mutation commentOnPost', () => {
10901090
describe('rate limiting', () => {
10911091
const redisKey = `${rateLimiterName}:1:createComment`;
10921092
const variables = { postId: 'p1', content: 'comment' };
1093+
1094+
beforeEach(async () => {
1095+
// Clear rate limit key before each test to ensure isolation
1096+
await deleteKeysByPattern(redisKey);
1097+
});
1098+
10931099
it('store rate limiting state in redis', async () => {
10941100
loggedUser = '1';
10951101

0 commit comments

Comments
 (0)