Skip to content

Commit 9dd7bd7

Browse files
Improve error handling in rate limit test to assert specific error message
1 parent 657e091 commit 9dd7bd7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/contentstack-config/test/unit/commands/rate-limit.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,13 @@ describe('Rate Limit Commands', () => {
9292
},
9393
});
9494
const config = { org: 'test-org-id', utilize: ['70'], 'limit-name': ['getLimit'] };
95-
await handler.setRateLimit(config);
96-
expect(errorMessage).to.include('Error: Unable to set the rate limit');
95+
try {
96+
await handler.setRateLimit(config);
97+
expect.fail('Expected an error to be thrown');
98+
} catch (error) {
99+
expect(error).to.be.an('error');
100+
expect(error.message).to.equal('Error: Client Error');
101+
}
97102
});
98103

99104
it('Set Rate Limit: should handle unauthenticated user', async () => {

0 commit comments

Comments
 (0)