Skip to content

Commit 0f49611

Browse files
committed
chore: use const for TimeoutError code in tests
1 parent ec31144 commit 0f49611

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/abort.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,15 @@ test('support setting the signal as a default option', async t => {
325325
t.true(signalHandlersRemoved(), 'Abort signal event handlers not removed');
326326
});
327327

328+
const timeoutErrorCode = 23;
328329
// See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static
329330
test('support AbortSignal.timeout()', async t => {
330331
const signal = AbortSignal.timeout(1);
331332

332333
const p = got('http://example.com', {signal});
333334

334335
await t.throwsAsync(p, {
335-
code: 23,
336+
code: timeoutErrorCode,
336337
message: 'The operation was aborted due to timeout',
337338
});
338339
});
@@ -347,7 +348,7 @@ test('support AbortSignal.timeout() without user abort', async t => {
347348
const p = got('http://example.com', {signal});
348349

349350
await t.throwsAsync(p, {
350-
code: 23,
351+
code: timeoutErrorCode,
351352
message: 'The operation was aborted due to timeout',
352353
});
353354

0 commit comments

Comments
 (0)