Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/contentstack-config/test/unit/commands/rate-limit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,13 @@ describe('Rate Limit Commands', () => {
},
});
const config = { org: 'test-org-id', utilize: ['70'], 'limit-name': ['getLimit'] };
await handler.setRateLimit(config);
expect(errorMessage).to.include('Error: Unable to set the rate limit');
try {
await handler.setRateLimit(config);
expect.fail('Expected an error to be thrown');
} catch (error) {
expect(error).to.be.an('error');
expect(error.message).to.equal('Error: Client Error');
}
});

it('Set Rate Limit: should handle unauthenticated user', async () => {
Expand Down Expand Up @@ -137,7 +142,10 @@ describe('Rate Limit Commands', () => {
it('Get Rate Limit: should print the rate limit for the given organization', async () => {
configHandler.set('rateLimit', rateLimit);
await GetRateLimitCommand.run(['--org', 'test-org-id']);
expect(printMessage).to.include(' test-org-id 10(70%) 0 1(80%) ');
expect(printMessage).to.include('test-org-id');
expect(printMessage).to.include('10(70%)');
expect(printMessage).to.include('0');
expect(printMessage).to.include('1(80%)');
});

it('Get Rate Limit: should throw an error if the organization is not found', async () => {
Expand Down