@@ -5,6 +5,8 @@ const later = require('@breejs/later');
5
5
const jobBuilder = require ( '../src/job-builder' ) ;
6
6
7
7
const root = path . join ( __dirname , 'jobs' ) ;
8
+ const jobPathBasic = path . join ( root , 'basic.js' ) ;
9
+
8
10
const baseConfig = {
9
11
root,
10
12
timeout : 0 ,
@@ -26,15 +28,20 @@ test(
26
28
job ,
27
29
null ,
28
30
{ } ,
29
- { name : 'basic' , path : ` ${ root } /basic.js` , timeout : 0 , interval : 0 }
31
+ { name : 'basic' , path : jobPathBasic , timeout : 0 , interval : 0 }
30
32
) ;
31
33
32
34
test (
33
35
'job name as file name with extension' ,
34
36
job ,
35
37
'basic.js' ,
36
38
{ } ,
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
+ }
38
45
) ;
39
46
40
47
function basic ( ) {
@@ -74,23 +81,23 @@ test(
74
81
job ,
75
82
{ name : 'basic' , path : '' } ,
76
83
{ } ,
77
- { name : 'basic' , path : ` ${ root } /basic.js` , timeout : 0 }
84
+ { name : 'basic' , path : jobPathBasic , timeout : 0 }
78
85
) ;
79
86
80
87
test (
81
88
'job.path is blank and name of job is defined with extension' ,
82
89
job ,
83
90
{ name : 'basic.js' , path : '' } ,
84
91
{ } ,
85
- { name : 'basic.js' , path : ` ${ root } /basic.js` , timeout : 0 }
92
+ { name : 'basic.js' , path : jobPathBasic , timeout : 0 }
86
93
) ;
87
94
88
95
test (
89
96
'job.path is path to file' ,
90
97
job ,
91
- { path : ` ${ root } /basic.js` } ,
98
+ { path : jobPathBasic } ,
92
99
{ } ,
93
- { path : ` ${ root } /basic.js` , timeout : 0 }
100
+ { path : jobPathBasic , timeout : 0 }
94
101
) ;
95
102
96
103
test (
@@ -104,26 +111,26 @@ test(
104
111
test (
105
112
'job.timeout is value' ,
106
113
job ,
107
- { path : ` ${ root } /basic.js` , timeout : 10 } ,
114
+ { path : jobPathBasic , timeout : 10 } ,
108
115
{ } ,
109
- { path : ` ${ root } /basic.js` , timeout : 10 }
116
+ { path : jobPathBasic , timeout : 10 }
110
117
) ;
111
118
112
119
test (
113
120
'job.interval is value' ,
114
121
job ,
115
- { path : ` ${ root } /basic.js` , interval : 10 } ,
122
+ { path : jobPathBasic , interval : 10 } ,
116
123
{ } ,
117
- { path : ` ${ root } /basic.js` , interval : 10 }
124
+ { path : jobPathBasic , interval : 10 }
118
125
) ;
119
126
120
127
test (
121
128
'job.cron is value' ,
122
129
job ,
123
- { path : ` ${ root } /basic.js` , cron : '* * * * *' } ,
130
+ { path : jobPathBasic , cron : '* * * * *' } ,
124
131
{ } ,
125
132
{
126
- path : ` ${ root } /basic.js` ,
133
+ path : jobPathBasic ,
127
134
cron : '* * * * *' ,
128
135
interval : later . parse . cron ( '* * * * *' )
129
136
}
@@ -132,10 +139,10 @@ test(
132
139
test (
133
140
'job.cron is value with hasSeconds config' ,
134
141
job ,
135
- { path : ` ${ root } /basic.js` , cron : '* * * * *' , hasSeconds : false } ,
142
+ { path : jobPathBasic , cron : '* * * * *' , hasSeconds : false } ,
136
143
{ } ,
137
144
{
138
- path : ` ${ root } /basic.js` ,
145
+ path : jobPathBasic ,
139
146
cron : '* * * * *' ,
140
147
interval : later . parse . cron ( '* * * * *' ) ,
141
148
hasSeconds : false
@@ -145,10 +152,10 @@ test(
145
152
test (
146
153
'job.cron is schedule' ,
147
154
job ,
148
- { path : ` ${ root } /basic.js` , cron : later . parse . cron ( '* * * * *' ) } ,
155
+ { path : jobPathBasic , cron : later . parse . cron ( '* * * * *' ) } ,
149
156
{ } ,
150
157
{
151
- path : ` ${ root } /basic.js` ,
158
+ path : jobPathBasic ,
152
159
cron : later . parse . cron ( '* * * * *' ) ,
153
160
interval : later . parse . cron ( '* * * * *' )
154
161
}
@@ -159,7 +166,7 @@ test(
159
166
job ,
160
167
{ name : 'basic' , interval : undefined } ,
161
168
{ interval : 10 } ,
162
- { name : 'basic' , path : ` ${ root } /basic.js` , timeout : 0 , interval : 10 }
169
+ { name : 'basic' , path : jobPathBasic , timeout : 0 , interval : 10 }
163
170
) ;
164
171
165
172
test (
@@ -170,7 +177,7 @@ test(
170
177
{
171
178
timezone : 'local' ,
172
179
name : 'basic' ,
173
- path : ` ${ root } /basic.js` ,
180
+ path : jobPathBasic ,
174
181
timeout : 0 ,
175
182
interval : 0
176
183
}
@@ -199,7 +206,7 @@ test(
199
206
{
200
207
timezone : 'local' ,
201
208
name : 'basic' ,
202
- path : ` ${ root } /basic.js` ,
209
+ path : jobPathBasic ,
203
210
timeout : 0
204
211
}
205
212
) ;
@@ -212,7 +219,7 @@ test(
212
219
{
213
220
timezone : 'America/New_York' ,
214
221
name : 'basic' ,
215
- path : ` ${ root } /basic.js` ,
222
+ path : jobPathBasic ,
216
223
timeout : 0
217
224
}
218
225
) ;
0 commit comments