@@ -5,6 +5,8 @@ const later = require('@breejs/later');
55const jobBuilder = require ( '../src/job-builder' ) ;
66
77const root = path . join ( __dirname , 'jobs' ) ;
8+ const jobPathBasic = path . join ( root , 'basic.js' ) ;
9+
810const baseConfig = {
911 root,
1012 timeout : 0 ,
@@ -26,15 +28,20 @@ test(
2628 job ,
2729 null ,
2830 { } ,
29- { name : 'basic' , path : ` ${ root } /basic.js` , timeout : 0 , interval : 0 }
31+ { name : 'basic' , path : jobPathBasic , timeout : 0 , interval : 0 }
3032) ;
3133
3234test (
3335 'job name as file name with extension' ,
3436 job ,
3537 'basic.js' ,
3638 { } ,
37- { name : 'basic.js' , path : `${ root } /basic.js` , timeout : 0 , interval : 0 }
39+ {
40+ name : 'basic.js' ,
41+ path : jobPathBasic ,
42+ timeout : 0 ,
43+ interval : 0
44+ }
3845) ;
3946
4047function basic ( ) {
@@ -74,23 +81,23 @@ test(
7481 job ,
7582 { name : 'basic' , path : '' } ,
7683 { } ,
77- { name : 'basic' , path : ` ${ root } /basic.js` , timeout : 0 }
84+ { name : 'basic' , path : jobPathBasic , timeout : 0 }
7885) ;
7986
8087test (
8188 'job.path is blank and name of job is defined with extension' ,
8289 job ,
8390 { name : 'basic.js' , path : '' } ,
8491 { } ,
85- { name : 'basic.js' , path : ` ${ root } /basic.js` , timeout : 0 }
92+ { name : 'basic.js' , path : jobPathBasic , timeout : 0 }
8693) ;
8794
8895test (
8996 'job.path is path to file' ,
9097 job ,
91- { path : ` ${ root } /basic.js` } ,
98+ { path : jobPathBasic } ,
9299 { } ,
93- { path : ` ${ root } /basic.js` , timeout : 0 }
100+ { path : jobPathBasic , timeout : 0 }
94101) ;
95102
96103test (
@@ -104,26 +111,26 @@ test(
104111test (
105112 'job.timeout is value' ,
106113 job ,
107- { path : ` ${ root } /basic.js` , timeout : 10 } ,
114+ { path : jobPathBasic , timeout : 10 } ,
108115 { } ,
109- { path : ` ${ root } /basic.js` , timeout : 10 }
116+ { path : jobPathBasic , timeout : 10 }
110117) ;
111118
112119test (
113120 'job.interval is value' ,
114121 job ,
115- { path : ` ${ root } /basic.js` , interval : 10 } ,
122+ { path : jobPathBasic , interval : 10 } ,
116123 { } ,
117- { path : ` ${ root } /basic.js` , interval : 10 }
124+ { path : jobPathBasic , interval : 10 }
118125) ;
119126
120127test (
121128 'job.cron is value' ,
122129 job ,
123- { path : ` ${ root } /basic.js` , cron : '* * * * *' } ,
130+ { path : jobPathBasic , cron : '* * * * *' } ,
124131 { } ,
125132 {
126- path : ` ${ root } /basic.js` ,
133+ path : jobPathBasic ,
127134 cron : '* * * * *' ,
128135 interval : later . parse . cron ( '* * * * *' )
129136 }
@@ -132,10 +139,10 @@ test(
132139test (
133140 'job.cron is value with hasSeconds config' ,
134141 job ,
135- { path : ` ${ root } /basic.js` , cron : '* * * * *' , hasSeconds : false } ,
142+ { path : jobPathBasic , cron : '* * * * *' , hasSeconds : false } ,
136143 { } ,
137144 {
138- path : ` ${ root } /basic.js` ,
145+ path : jobPathBasic ,
139146 cron : '* * * * *' ,
140147 interval : later . parse . cron ( '* * * * *' ) ,
141148 hasSeconds : false
@@ -145,10 +152,10 @@ test(
145152test (
146153 'job.cron is schedule' ,
147154 job ,
148- { path : ` ${ root } /basic.js` , cron : later . parse . cron ( '* * * * *' ) } ,
155+ { path : jobPathBasic , cron : later . parse . cron ( '* * * * *' ) } ,
149156 { } ,
150157 {
151- path : ` ${ root } /basic.js` ,
158+ path : jobPathBasic ,
152159 cron : later . parse . cron ( '* * * * *' ) ,
153160 interval : later . parse . cron ( '* * * * *' )
154161 }
@@ -159,7 +166,7 @@ test(
159166 job ,
160167 { name : 'basic' , interval : undefined } ,
161168 { interval : 10 } ,
162- { name : 'basic' , path : ` ${ root } /basic.js` , timeout : 0 , interval : 10 }
169+ { name : 'basic' , path : jobPathBasic , timeout : 0 , interval : 10 }
163170) ;
164171
165172test (
@@ -170,7 +177,7 @@ test(
170177 {
171178 timezone : 'local' ,
172179 name : 'basic' ,
173- path : ` ${ root } /basic.js` ,
180+ path : jobPathBasic ,
174181 timeout : 0 ,
175182 interval : 0
176183 }
@@ -199,7 +206,7 @@ test(
199206 {
200207 timezone : 'local' ,
201208 name : 'basic' ,
202- path : ` ${ root } /basic.js` ,
209+ path : jobPathBasic ,
203210 timeout : 0
204211 }
205212) ;
@@ -212,7 +219,7 @@ test(
212219 {
213220 timezone : 'America/New_York' ,
214221 name : 'basic' ,
215- path : ` ${ root } /basic.js` ,
222+ path : jobPathBasic ,
216223 timeout : 0
217224 }
218225) ;
0 commit comments