Writing a test without an if statement

Is there a way to write this test without the if statement?

  it("can't find the user", () =>
    Effect.gen(function* ($) {
      const actual = yield* $(
        __test__.generateLoginOptionsEffect('unknown@user.org'),
        Effect.either
      )

      expect(Either.isLeft(actual)).toBeTruthy()
      if (Either.isLeft(actual)) {
        expect(actual.left).toMatchObject(new NoUserFound())
      }
    }).pipe(runTest(null)))
Was this page helpful?