Skip to content

Commit 259a22a

Browse files
committed
fix tests
1 parent 845ceb0 commit 259a22a

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @code.store/arcxp-sdk-ts
22

3+
## 5.1.6
4+
5+
### Patch Changes
6+
7+
- fix tests
8+
39
## 5.1.5
410

511
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code.store/arcxp-sdk-ts",
3-
"version": "5.1.5",
3+
"version": "5.1.6",
44
"description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.",
55
"type": "module",
66
"main": "./dist/index.js",

src/api/abstract-api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type ArcAbstractAPIOptions = {
88
credentials: { organizationName: string; accessToken: string };
99
apiPath: string;
1010
maxRPS?: number;
11+
maxRetries?: number;
1112
};
1213

1314
export type ArcAPIOptions = Omit<ArcAbstractAPIOptions, 'apiPath'>;
@@ -38,7 +39,7 @@ export abstract class ArcAbstractAPI {
3839
// apply retry
3940
const retry = typeof axiosRetry === 'function' ? axiosRetry : (axiosRetry as any).default;
4041
retry(this.client, {
41-
retries: 10,
42+
retries: options.maxRetries || 10,
4243
retryDelay: axiosRetry.exponentialDelay,
4344
retryCondition: (err: AxiosError) => this.retryCondition(err),
4445
});

src/tests/api/retry.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ describe('Arc API retry logic', () => {
3838
});
3939

4040
test('fails after max retries (always 429)', async () => {
41-
nock(base).get(/.*/).times(6).reply(429, { message: 'Too Many Requests' });
41+
nock(base).get(/.*/).times(3).reply(429, { message: 'Too Many Requests' });
4242

4343
const API = ArcAPI({
4444
credentials: { organizationName: org, accessToken },
45+
maxRetries: 2,
4546
});
4647

4748
await expect(API.Draft.generateId(Date.now().toString())).rejects.toMatchObject({

0 commit comments

Comments
 (0)