import { expect } from 'chai' import Response from '../../src/API/Response.js' import Process from '../../src/BaseEvent/Process.js' describe('Process success invocation path', () => { test('Simple success', async () => { const b = { name: '123' } const proc = new Process({}, 100) let count = 0 const handlerResp = await proc.execute(async () => { count++ return Response.SuccessResponse(b) }) // check resp expect(handlerResp).to.be.undefined // check iterations return new Promise(resolve => { setTimeout(() => { expect(count).to.be.equals(2) clearInterval(proc.timeout) resolve(null) }, 250) }) }) }) describe('Process failure invocation path', () => { test('Simple failure', async () => { const proc = new Process({}, 100) let count = 0 const handlerResp = await proc.execute(async () => { count++ throw new Error('Failed!') }) // check resp expect(handlerResp).to.be.undefined // check iterations return new Promise(resolve => { setTimeout(() => { expect(count).to.be.equals(2) clearInterval(proc.timeout) resolve(null) }, 250) }) }) }) export {}