Optimizing Error Handling in Test Assertions

Is there a better way than this?
expect(actual._tag).toEqual('Failure')
if (actual._tag === 'Failure' && actual.cause._tag === 'Fail') {
  expect(actual.cause.error._tag).toBe(MyCustomError.name)
}
Was this page helpful?