|
1 | 1 | import fs from 'node:fs'; |
2 | 2 | import axios, { type InternalAxiosRequestConfig } from 'axios'; |
3 | 3 | import { assert, expect } from 'chai'; |
4 | | -import nock from 'nock'; |
| 4 | +import nock, { type ReplyHeaders } from 'nock'; |
5 | 5 | import sinon from 'sinon'; |
6 | 6 | import { |
7 | 7 | type RequestConfig, |
@@ -801,7 +801,7 @@ describe('WebClient', () => { |
801 | 801 |
|
802 | 802 | describe('has an option to set request concurrency', () => { |
803 | 803 | // TODO: factor out common logic into test helpers |
804 | | - const responseDelay = 100; // ms |
| 804 | + const responseDelay = 500; // ms |
805 | 805 | let testStart: number; |
806 | 806 | let scope: nock.Scope; |
807 | 807 |
|
@@ -1102,14 +1102,15 @@ describe('WebClient', () => { |
1102 | 1102 | }); |
1103 | 1103 |
|
1104 | 1104 | it('should throw an error if the response has no retry info', async () => { |
1105 | | - // @ts-expect-error header values cannot be undefined |
1106 | | - const scope = nock('https://slack.com').post(/api/).reply(429, {}, { 'retry-after': undefined }); |
| 1105 | + const emptyHeaders: ReplyHeaders & { 'retry-after'?: never } = {}; // Ensure that 'retry-after' is not in the headers |
| 1106 | + const scope = nock('https://slack.com').post(/api/).reply(429, {}, emptyHeaders); |
1107 | 1107 | const client = new WebClient(token); |
1108 | 1108 | try { |
1109 | 1109 | await client.apiCall('method'); |
1110 | 1110 | assert.fail('expected error to be thrown'); |
1111 | 1111 | } catch (err) { |
1112 | 1112 | assert.instanceOf(err, Error); |
| 1113 | + } finally { |
1113 | 1114 | scope.done(); |
1114 | 1115 | } |
1115 | 1116 | }); |
|
0 commit comments