it.scoped('should clean up resources when the service is closed', () =>
Effect
.gen(function*() {
// the service, which will be automatically cleaned up when the scoped test completes
const service = yield* WhatsappService;
// Add a finalizer to check if destroy is called
yield* Effect.addFinalizer(() =>
Effect.sync(() => {
// This will be called when the scope is closed
expect(mockClient.destroy).toHaveBeenCalled();
})
);
})
.pipe(deps));
it.scoped('should clean up resources when the service is closed', () =>
Effect
.gen(function*() {
// the service, which will be automatically cleaned up when the scoped test completes
const service = yield* WhatsappService;
// Add a finalizer to check if destroy is called
yield* Effect.addFinalizer(() =>
Effect.sync(() => {
// This will be called when the scope is closed
expect(mockClient.destroy).toHaveBeenCalled();
})
);
})
.pipe(deps));