Skip to content

Commit dd59d35

Browse files
Copilotbtravers
andcommitted
fix: correct import sorting and type assertions for linting compliance
- Fix import order to comply with eslint sort-imports rule - Fix type assertions in retry.spec.ts tests - All linting, typechecking, and tests now pass Co-authored-by: btravers <[email protected]>
1 parent 6bb5f33 commit dd59d35

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

packages/worker/src/retry.spec.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1+
import { RETRY_COUNT_HEADER, calculateBackoffDelay, getRetryCount, shouldRetry } from "./retry.js";
12
import { describe, expect, it } from "vitest";
23
import type { Message } from "amqplib";
34
import type { RetryPolicy } from "@amqp-contract/contract";
4-
import {
5-
RETRY_COUNT_HEADER,
6-
calculateBackoffDelay,
7-
getRetryCount,
8-
shouldRetry,
9-
} from "./retry.js";
105

116
describe("Retry utilities", () => {
127
describe("getRetryCount", () => {
@@ -15,15 +10,15 @@ describe("Retry utilities", () => {
1510
properties: {
1611
headers: {},
1712
},
18-
} as Message;
13+
} as unknown as Message;
1914

2015
expect(getRetryCount(msg)).toBe(0);
2116
});
2217

2318
it("should return 0 when headers are undefined", () => {
2419
const msg = {
2520
properties: {},
26-
} as Message;
21+
} as unknown as Message;
2722

2823
expect(getRetryCount(msg)).toBe(0);
2924
});
@@ -35,7 +30,7 @@ describe("Retry utilities", () => {
3530
[RETRY_COUNT_HEADER]: 3,
3631
},
3732
},
38-
} as Message;
33+
} as unknown as Message;
3934

4035
expect(getRetryCount(msg)).toBe(3);
4136
});
@@ -47,7 +42,7 @@ describe("Retry utilities", () => {
4742
[RETRY_COUNT_HEADER]: "invalid",
4843
},
4944
},
50-
} as Message;
45+
} as unknown as Message;
5146

5247
expect(getRetryCount(msg)).toBe(0);
5348
});
@@ -59,7 +54,7 @@ describe("Retry utilities", () => {
5954
[RETRY_COUNT_HEADER]: -1,
6055
},
6156
},
62-
} as Message;
57+
} as unknown as Message;
6358

6459
expect(getRetryCount(msg)).toBe(0);
6560
});
@@ -144,7 +139,7 @@ describe("Retry utilities", () => {
144139
[RETRY_COUNT_HEADER]: 100,
145140
},
146141
},
147-
} as Message;
142+
} as unknown as Message;
148143

149144
const result = shouldRetry(msg, undefined);
150145

@@ -172,7 +167,7 @@ describe("Retry utilities", () => {
172167
[RETRY_COUNT_HEADER]: 1,
173168
},
174169
},
175-
} as Message;
170+
} as unknown as Message;
176171

177172
const result = shouldRetry(msg, policy);
178173

@@ -194,7 +189,7 @@ describe("Retry utilities", () => {
194189
[RETRY_COUNT_HEADER]: 3,
195190
},
196191
},
197-
} as Message;
192+
} as unknown as Message;
198193

199194
const result = shouldRetry(msg, policy);
200195

@@ -216,7 +211,7 @@ describe("Retry utilities", () => {
216211
[RETRY_COUNT_HEADER]: 5,
217212
},
218213
},
219-
} as Message;
214+
} as unknown as Message;
220215

221216
const result = shouldRetry(msg, policy);
222217

@@ -243,7 +238,7 @@ describe("Retry utilities", () => {
243238
[RETRY_COUNT_HEADER]: 2,
244239
},
245240
},
246-
} as Message;
241+
} as unknown as Message;
247242

248243
const result = shouldRetry(msg, policy);
249244

@@ -263,7 +258,7 @@ describe("Retry utilities", () => {
263258
properties: {
264259
headers: {},
265260
},
266-
} as Message;
261+
} as unknown as Message;
267262

268263
const result = shouldRetry(msg, policy);
269264

packages/worker/src/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import type {
88
} from "@amqp-contract/contract";
99
import { Future, Result } from "@swan-io/boxed";
1010
import { MessageValidationError, TechnicalError } from "./errors.js";
11+
import { RETRY_COUNT_HEADER, shouldRetry } from "./retry.js";
1112
import type {
1213
WorkerInferConsumerBatchHandler,
1314
WorkerInferConsumerHandler,
1415
WorkerInferConsumerHandlers,
1516
WorkerInferConsumerInput,
1617
} from "./types.js";
1718
import { decompressBuffer } from "./decompression.js";
18-
import { RETRY_COUNT_HEADER, shouldRetry } from "./retry.js";
1919

2020
/**
2121
* Internal type for consumer options extracted from handler tuples.

0 commit comments

Comments
 (0)