Skip to content

Commit 274e723

Browse files
committed
Update: Add test for a custom registry's set method returning undefined
1 parent 5aa1ce8 commit 274e723

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/registry.js

+23
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ CustomRegistry.prototype.get = noop;
2020
CustomRegistry.prototype.set = noop;
2121
CustomRegistry.prototype.tasks = noop;
2222

23+
function SetNoReturnRegistry() {
24+
this._tasks = {};
25+
}
26+
SetNoReturnRegistry.prototype.init = noop;
27+
SetNoReturnRegistry.prototype.get = function(name) {
28+
return this.tasks[name];
29+
};
30+
SetNoReturnRegistry.prototype.set = function(name, fn) {
31+
this.tasks[name] = fn;
32+
};
33+
SetNoReturnRegistry.prototype.tasks = noop;
34+
2335
function InvalidRegistry() {}
2436

2537
describe('registry', function() {
@@ -175,4 +187,15 @@ describe('registry', function() {
175187
});
176188
});
177189

190+
it('does not require the `set` method to return a task', function(done) {
191+
var taker = new Undertaker();
192+
taker.registry(new SetNoReturnRegistry());
193+
taker.task('test', noop);
194+
taker.on('start', function(data) {
195+
expect(data.name).to.equal('test');
196+
done();
197+
});
198+
taker.series('test')();
199+
});
200+
178201
});

0 commit comments

Comments
 (0)