Skip to content

Commit 2fcc5d0

Browse files
Nicita01lundibundi
authored andcommitted
Fix metasync.do chaining
Reverts accidental change of function -> arrow-function that broke the context of 'do'. Refs: #365 PR-URL: #390
1 parent e1e7530 commit 2fcc5d0

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/do.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function Do() {}
44

5-
const chain = (fn, ...args) => {
5+
const chain = function(fn, ...args) {
66
const current = done => {
77
if (done) current.done = done;
88
if (current.prev) {

test/do.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,33 @@ const wrapAsync = callback => {
88
};
99

1010
metatests.test('simple chain/do', test => {
11-
const readConfig = (name, callback) => {
11+
const readConfig = test.mustCall((name, callback) => {
1212
test.strictSame(name, 'myConfig');
1313
wrapAsync(() => {
1414
callback(null, { name });
1515
});
16-
};
16+
});
1717

18-
const selectFromDb = (query, callback) => {
18+
const selectFromDb = test.mustCall((query, callback) => {
1919
test.strictSame(query, 'select * from cities');
2020
wrapAsync(() => {
2121
callback(null, [{ name: 'Kiev' }, { name: 'Roma' }]);
2222
});
23-
};
23+
});
2424

25-
const getHttpPage = (url, callback) => {
25+
const getHttpPage = test.mustCall((url, callback) => {
2626
test.strictSame(url, 'http://kpi.ua');
2727
wrapAsync(() => {
2828
callback(null, '<html>Some archaic web here</html>');
2929
});
30-
};
30+
});
3131

32-
const readFile = (path, callback) => {
32+
const readFile = test.mustCall((path, callback) => {
3333
test.strictSame(path, 'README.md');
3434
wrapAsync(() => {
3535
callback(null, 'file content');
3636
});
37-
};
37+
});
3838

3939
const c1 = metasync
4040
.do(readConfig, 'myConfig')

0 commit comments

Comments
 (0)