Formatting
This commit is contained in:
@@ -156,7 +156,7 @@ const testExponentialBackoffThrowsMaxRetriesHitErrorWhenExhausted = async (): Pr
|
|||||||
expect.fail('Expected ExponentialBackoffMaxRetriesHitError to be thrown');
|
expect.fail('Expected ExponentialBackoffMaxRetriesHitError to be thrown');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
expect(error).toBeInstanceOf(ExponentialBackoffMaxRetriesHitError);
|
expect(error).toBeInstanceOf(ExponentialBackoffMaxRetriesHitError);
|
||||||
expect((error as ExponentialBackoffMaxRetriesHitError).cause).toEqual([firstError, lastError]);
|
expect((error as ExponentialBackoffMaxRetriesHitError).cause).toEqual([ firstError, lastError ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(fn).toHaveBeenCalledTimes(2);
|
expect(fn).toHaveBeenCalledTimes(2);
|
||||||
@@ -181,7 +181,7 @@ const testExponentialBackoffWrapsNonErrorThrows = async (): Promise<void> => {
|
|||||||
expect.fail('Expected ExponentialBackoffMaxRetriesHitError to be thrown');
|
expect.fail('Expected ExponentialBackoffMaxRetriesHitError to be thrown');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
expect(error).toBeInstanceOf(ExponentialBackoffMaxRetriesHitError);
|
expect(error).toBeInstanceOf(ExponentialBackoffMaxRetriesHitError);
|
||||||
const [wrappedError] = (error as ExponentialBackoffMaxRetriesHitError).cause as Error[];
|
const [ wrappedError ] = (error as ExponentialBackoffMaxRetriesHitError).cause as Error[];
|
||||||
expect(wrappedError).toBeInstanceOf(Error);
|
expect(wrappedError).toBeInstanceOf(Error);
|
||||||
expect(wrappedError.message).toBe('not-an-error');
|
expect(wrappedError.message).toBe('not-an-error');
|
||||||
}
|
}
|
||||||
@@ -355,7 +355,10 @@ const runTests = async (): Promise<void> => {
|
|||||||
test('ExponentialBackoff: returns the result on first success', testExponentialBackoffSucceedsOnFirstAttempt);
|
test('ExponentialBackoff: returns the result on first success', testExponentialBackoffSucceedsOnFirstAttempt);
|
||||||
test('ExponentialBackoff: retries until the function succeeds', testExponentialBackoffRetriesUntilSuccess);
|
test('ExponentialBackoff: retries until the function succeeds', testExponentialBackoffRetriesUntilSuccess);
|
||||||
test('ExponentialBackoff: calls onError for each failed attempt', testExponentialBackoffCallsOnErrorForEachFailure);
|
test('ExponentialBackoff: calls onError for each failed attempt', testExponentialBackoffCallsOnErrorForEachFailure);
|
||||||
test('ExponentialBackoff: throws ExponentialBackoffMaxRetriesHitError when max attempts are exhausted', testExponentialBackoffThrowsMaxRetriesHitErrorWhenExhausted);
|
test(
|
||||||
|
'ExponentialBackoff: throws ExponentialBackoffMaxRetriesHitError when max attempts are exhausted',
|
||||||
|
testExponentialBackoffThrowsMaxRetriesHitErrorWhenExhausted,
|
||||||
|
);
|
||||||
test('ExponentialBackoff: wraps non-Error throws before calling onError', testExponentialBackoffWrapsNonErrorThrows);
|
test('ExponentialBackoff: wraps non-Error throws before calling onError', testExponentialBackoffWrapsNonErrorThrows);
|
||||||
test('ExponentialBackoff: works via from and instance run', testExponentialBackoffFromAndInstanceRun);
|
test('ExponentialBackoff: works via from and instance run', testExponentialBackoffFromAndInstanceRun);
|
||||||
test('ExponentialBackoff: retries indefinitely when maxAttempts is 0', testExponentialBackoffRetriesIndefinitelyWhenMaxAttemptsIsZero);
|
test('ExponentialBackoff: retries indefinitely when maxAttempts is 0', testExponentialBackoffRetriesIndefinitelyWhenMaxAttemptsIsZero);
|
||||||
|
|||||||
Reference in New Issue
Block a user