@hegeldev/hegel
    Preparing search index...

    Function testAsync

    • Run a property-based test with an asynchronous test body.

      Returns a Promise<void> that resolves when the test completes and rejects if any test case fails.

      Parameters

      • testFn: (tc: TestCase) => void | Promise<void>
      • Optionalsettings: Partial<Settings>

      Returns Promise<void>

      import { test } from 'vitest';
      import * as hegel from 'hegel';
      import * as gs from 'hegel/generators';

      test('my async test', () =>
      hegel.testAsync(async (tc) => {
      const x = tc.draw(gs.integers());
      const result = await someAsyncOperation(x);
      expect(result).toEqual(expected(x));
      }),
      );