+ it('Verify that is possible to invoke the execute method without input', async () => {
+ const result = await pool.execute()
+ expect(result).toBeDefined()
+ expect(result).toBeFalsy()
+ })
+
+ it('Verify that is possible to have a worker that return undefined', async () => {
+ const result = await emptyPool.execute()
+ expect(result).toBeFalsy()
+ })
+
+ it('Verify that data are sent to the worker correctly', async () => {
+ const data = { f: 10 }
+ const result = await echoPool.execute(data)
+ expect(result).toBeTruthy()
+ expect(result.f).toBe(data.f)
+ })
+
+ it('Verify that error handling is working properly', async () => {
+ const data = { f: 10 }
+ let inError
+ try {
+ await errorPool.execute(data)
+ } catch (e) {
+ inError = e
+ }
+ expect(inError).toBeTruthy()
+ expect(inError instanceof Error).toBeTruthy()
+ expect(inError.message).toBeTruthy()
+ })
+