@@ -68,6 +68,9 @@ describe('Context', () => {
6868 } ) ;
6969 describe ( '#next' , ( ) => {
7070 let task = { } ;
71+ const job = ( ctx , done ) => {
72+ done ( ) ;
73+ }
7174 beforeEach ( ( ) => {
7275 task = {
7376 id : '101020teste2010' ,
@@ -88,8 +91,11 @@ describe('Context', () => {
8891 executions : 1
8992 }
9093 const ctx = new Context ( incrementalTask ) ;
91- ctx . start ( ) ;
92- ctx . stop ( ) ;
94+ ctx . done = ( ) => {
95+ ctx . stop ( ) ;
96+ }
97+ ctx . start ( job ) ;
98+
9399 const next = {
94100 ...task ,
95101 status : 'failed' ,
@@ -105,8 +111,10 @@ describe('Context', () => {
105111 describe ( 'When error' , ( ) => {
106112 it ( 'without retry the status is "failed"' , ( ) => {
107113 const ctx = new Context ( task ) ;
108- ctx . start ( ) ;
109- ctx . stop ( ) ;
114+ ctx . done = ( ) => {
115+ ctx . stop ( ) ;
116+ }
117+ ctx . start ( job ) ;
110118 const next = {
111119 ...task ,
112120 status : 'failed' ,
@@ -131,8 +139,10 @@ describe('Context', () => {
131139 }
132140 } ;
133141 const ctx = new Context ( retryableTask ) ;
134- ctx . start ( ) ;
135- ctx . stop ( ) ;
142+ ctx . done = ( ) => {
143+ ctx . stop ( ) ;
144+ }
145+ ctx . start ( job ) ;
136146 const next = {
137147 ...retryableTask ,
138148 date : '2019-12-20T12:14:25.864Z' ,
@@ -150,8 +160,10 @@ describe('Context', () => {
150160 describe ( 'When success' , ( ) => {
151161 it ( 'without repeat option' , ( ) => {
152162 const ctx = new Context ( task ) ;
153- ctx . start ( ) ;
154- ctx . stop ( ) ;
163+ ctx . done = ( ) => {
164+ ctx . stop ( ) ;
165+ }
166+ ctx . start ( job ) ;
155167 const next = {
156168 ...task ,
157169 status : 'complete' ,
@@ -169,8 +181,10 @@ describe('Context', () => {
169181 ...task ,
170182 retries : 3
171183 } ) ;
172- ctx . start ( ) ;
173- ctx . stop ( ) ;
184+ ctx . done = ( ) => {
185+ ctx . stop ( ) ;
186+ }
187+ ctx . start ( job ) ;
174188 const next = {
175189 ...task ,
176190 status : 'complete' ,
@@ -196,8 +210,10 @@ describe('Context', () => {
196210 }
197211 } ;
198212 const ctx = new Context ( repeatableTask ) ;
199- ctx . start ( ) ;
200- ctx . stop ( ) ;
213+ ctx . done = ( ) => {
214+ ctx . stop ( ) ;
215+ }
216+ ctx . start ( job ) ;
201217 const next = {
202218 ...repeatableTask ,
203219 date : '2019-12-20T12:14:25.864Z' ,
0 commit comments