How to test if a void async function was successful with jest?

This is the best way that I've found. Hoping there's something more elegant.

describe("Foo.bar()", () => {
  it("should not throw", async () => {
    expect.assertions(1);

    try {
      await new Foo().bar();
      expect(true).toBeTruthy();
    } catch {
      // should not come here
    }
  });
});

This is the most semantic way I've found. It is even just a translation of the test name.

describe("Foo.bar()", () => {
      test("Should not throw", async () => {
        await expect(new Foo().bar()).resolves.not.toThrow();
      });
    });

The Promise has the advantage that it should not throw at all, rather be resolved or rejected. On the other hand the toBe() assertion expects an argument, even though there is a Promise<void> in TypeScript.

So what if there is no argument passed (or the argument is void) but it is still evaluated. The the argument is undefined.

  test("Should resolve", async () => {
      await expect(new Foo().bar()).resolves.toBe(undefined);
  });

Testing for not.toThrow() happend to be a false friend for me, because my Foo.bar() did not throw, nor was it resolved either.