Skip to content

Commit

Permalink
Updated rate limit and test duration
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedAziz-Hammami committed Feb 5, 2025
1 parent e5221af commit 9739f4b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions backend/test/unit/enrichment-service/proxycurl/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ describe('ProxycurlApi', () => {
url: 'https://api.example.com',
apiKey: 'dummy-api-key',
rateLimiter: {
requests: 5,
interval: 1000,
requests: 10,
interval: 200,
maxRetries: 3,
spaced: false
}
Expand Down Expand Up @@ -92,7 +92,6 @@ describe('ProxycurlApi', () => {
lookup_depth: 'superficial',
enrich_profile: 'skip'
};

mockAxiosInstance.get.mockReturnValue({
data: {
email,
Expand All @@ -116,7 +115,7 @@ describe('ProxycurlApi', () => {
const duration = end - start;
const tolerance = 10; // Allow a 10ms margin of error to account for slight timing variations

expect(duration).toBeGreaterThanOrEqual(1000 - tolerance);
expect(duration).toBeGreaterThanOrEqual(2000 - tolerance);
expect(mockAxiosInstance.get).toHaveBeenCalledTimes(10);
});
});
Expand Down
6 changes: 3 additions & 3 deletions backend/test/unit/enrichment-service/thedig/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ describe('ThedigApi', () => {
url: 'https://api.example.com',
apiToken: 'test-token',
rateLimiter: {
requests: 5,
interval: 1000,
requests: 10,
interval: 200,
spaced: false
}
},
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('ThedigApi', () => {
const duration = end - start;
const tolerance = 10; // Allow a 10ms margin of error to account for slight timing variations

expect(duration).toBeGreaterThanOrEqual(1000 - tolerance);
expect(duration).toBeGreaterThanOrEqual(2000 - tolerance);
expect(mockAxiosInstance.post).toHaveBeenCalledTimes(10);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('VoilanorbertApi', () => {
apiToken: 'testToken',
rateLimiter: {
requests: 5,
interval: 1000,
interval: 200,
spaced: false
}
};
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('VoilanorbertApi', () => {
const tolerance = 10; // Allow a 10ms margin of error to account for slight timing variations

expect(duration).toBeGreaterThanOrEqual(1000 - tolerance);
expect(axios.create().post).toHaveBeenCalledTimes(10);
expect(axios.create().post).toHaveBeenCalledTimes(5);
});

it('should log an error and throw it when the request fails', async () => {
Expand Down

0 comments on commit 9739f4b

Please sign in to comment.