Skip to content

Commit 026b165

Browse files
author
Pranav Ravichandran
authored
feat(periodicBuilds): Implement boilerplate startPeriodic() and stopPeriodic() (#39)
feat(periodicBuilds): Implement boilerplate startPeriodic() and stopPeriodic()
1 parent 85f4bda commit 026b165

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

index.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,34 @@ class Executor {
6969
throw new Error('Not implemented');
7070
}
7171

72+
/**
73+
* Starts a new periodic build in an executor
74+
* @method _startPeriodic
75+
* @param {Object} config Configuration
76+
* @return {Promise}
77+
*/
78+
startPeriodic(config) {
79+
return this._startPeriodic(config);
80+
}
81+
82+
async _startPeriodic() {
83+
throw new Error('Not implemented');
84+
}
85+
86+
/**
87+
* Stops a previously scheduled periodic build in an executor
88+
* @async _stopPeriodic
89+
* @param {Object} config Configuration
90+
* @return {Promise}
91+
*/
92+
stopPeriodic(config) {
93+
return this._stopPeriodic(config);
94+
}
95+
96+
async _stopPeriodic() {
97+
throw new Error('Not implemented');
98+
}
99+
72100
/**
73101
* Get the status of a build
74102
* @method status

test/index.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ describe('index test', () => {
2222
executor: {
2323
start: Joi.object().required(),
2424
stop: Joi.object().required(),
25+
startPeriodic: Joi.object().required(),
26+
stopPeriodic: Joi.object().required(),
2527
status: Joi.object().required()
2628
}
2729
}
@@ -92,6 +94,26 @@ describe('index test', () => {
9294
})
9395
));
9496

97+
it('startPeriodic returns an error when not overridden', () => (
98+
instance.startPeriodic({})
99+
.then(() => {
100+
throw new Error('Oh no');
101+
}, (err) => {
102+
assert.isOk(err, 'err is null');
103+
assert.equal(err.message, 'Not implemented');
104+
})
105+
));
106+
107+
it('stopPeriodic returns an error when not overridden', () => (
108+
instance.stopPeriodic({})
109+
.then(() => {
110+
throw new Error('Oh no');
111+
}, (err) => {
112+
assert.isOk(err, 'error is null');
113+
assert.equal(err.message, 'Not implemented');
114+
})
115+
));
116+
95117
it('status returns an error when not overridden', () => (
96118
instance.status({})
97119
.then(() => {

0 commit comments

Comments
 (0)