Security Remediation: All Phases Complete (84 fixes) #348
@@ -160,21 +160,25 @@ describe("Retry Utility", () => {
|
||||
expect(operation).toHaveBeenCalledTimes(4);
|
||||
});
|
||||
|
||||
it("should verify exponential backoff timing", () => {
|
||||
it("should verify exponential backoff timing", async () => {
|
||||
const operation = vi.fn().mockRejectedValue({
|
||||
code: "ECONNREFUSED",
|
||||
message: "Connection refused",
|
||||
name: "Error",
|
||||
});
|
||||
|
||||
// Just verify the function is called multiple times with retries
|
||||
const promise = withRetry(operation, {
|
||||
maxRetries: 2,
|
||||
initialDelay: 10,
|
||||
// Verify the function attempts multiple retries and eventually throws
|
||||
await expect(
|
||||
withRetry(operation, {
|
||||
maxRetries: 2,
|
||||
initialDelay: 10,
|
||||
})
|
||||
).rejects.toMatchObject({
|
||||
message: "Connection refused",
|
||||
});
|
||||
|
||||
// We don't await this - just verify the retry configuration exists
|
||||
expect(promise).toBeInstanceOf(Promise);
|
||||
// Should be called 3 times (initial + 2 retries)
|
||||
expect(operation).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user