Effect CommunityEC
Effect Community2y ago
12 replies
attila

Effectful integration testing

A question about integration testing: let's assume I need to acquire a resource before running a bunch of tests and release it after all the tests finished running regardless of whether they failed or passed. How do I get this done? I can do the resource acquisition and release bits but how do I wait for the tests to finish, though? I would like my final API to look something like this (pseudo-code alert):
withAccount((account) => {
  test("testing scenario 1", () =>
    underTest(account, {/* params for scenario 1 */}).pipe(Effect.runPromise)
  )

  test("testing scenario 2", () =>
    underTest(account, {/* params for scenario 2 */}).pipe(Effect.runPromise)
  )
})

Has anyone worked on something like this before?
Was this page helpful?