diff --git a/__test__/async-function.test.ts b/__test__/async-function.test.ts index d68b302..e36e74a 100644 --- a/__test__/async-function.test.ts +++ b/__test__/async-function.test.ts @@ -2,13 +2,21 @@ import {callAsyncFunction} from '../src/async-function' -describe('callAsyncFunction', () => { +describe(callAsyncFunction.name, () => { test('calls the function with its arguments', async () => { const result = await callAsyncFunction({foo: 'bar'} as any, 'return foo') expect(result).toEqual('bar') }) - test('throws on ReferenceError', async () => { + test('can await a Promise', async () => { + const result = await callAsyncFunction( + {} as any, + 'return await new Promise(resolve => resolve("bar"))' + ) + expect(result).toEqual('bar') + }) + + test(`throws an ${ReferenceError.name}`, async () => { expect.assertions(1) try { diff --git a/__test__/get-retry-options.test.ts b/__test__/get-retry-options.test.ts index 13fd3f7..a21c3e2 100644 --- a/__test__/get-retry-options.test.ts +++ b/__test__/get-retry-options.test.ts @@ -2,7 +2,7 @@ import {getRetryOptions} from '../src/retry-options' -describe('getRequestOptions', () => { +describe(getRetryOptions.name, () => { test('retries disabled if retries == 0', async () => { const [retryOptions, requestOptions] = getRetryOptions( 0,