| 207 | } |
| 208 | |
| 209 | export const makeTestWorkspaceHarness = <const TPlugins extends readonly AnyPlugin[] = readonly []>( |
| 210 | options?: TestConfigOptions<TPlugins>, |
| 211 | ) => |
| 212 | Effect.acquireRelease( |
| 213 | Effect.gen(function* () { |
| 214 | const config = makeTestConfig(options); |
| 215 | const executor = yield* createExecutor(config); |
| 216 | return { |
| 217 | config, |
| 218 | executor, |
| 219 | testDb: config.testDb, |
| 220 | tenant: String(config.tenant), |
| 221 | subject: config.subject != null ? String(config.subject) : null, |
| 222 | } as const; |
| 223 | }), |
| 224 | ({ executor, testDb }) => |
| 225 | executor |
| 226 | .close() |
| 227 | .pipe( |
| 228 | Effect.ignore, |
| 229 | Effect.andThen(Effect.promise(() => testDb.close()).pipe(Effect.ignore)), |
| 230 | ), |
| 231 | ); |
| 232 | |
| 233 | export const makeTestWorkspaceLayer = <const TPlugins extends readonly AnyPlugin[] = readonly []>( |
| 234 | options?: TestConfigOptions<TPlugins>, |