Skip to content

Commit 174c72a

Browse files
committed
Remove callback version of every test.
1 parent 62c54d8 commit 174c72a

File tree

2 files changed

+12
-27
lines changed

2 files changed

+12
-27
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
- Initial support for benchmarking.
55
- Basic callback interface tests.
66

7+
### Removed
8+
- Callback version of every test.
9+
- Callback interface tests added to catch callback API errors.
10+
- Avoids duplication of running every test for promises and callbacks.
11+
- Simplifies testing code and makes async/await conversion easier.
12+
713
## 1.1.0 - 2018-09-05
814

915
### Added

tests/test-common.js

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -270,24 +270,12 @@ function addTest(manifest, test, tests) {
270270
test.manifest = manifest;
271271
const description = test_id + ' ' + (test.purpose || test.name);
272272

273-
if(options.benchmark) {
274-
// only promises
275-
tests.push({
276-
title: description,
277-
f: makeFn({useCallbacks: false})
278-
});
279-
} else {
280-
tests.push({
281-
title: description + ' (promise)',
282-
f: makeFn({useCallbacks: false})
283-
});
284-
tests.push({
285-
title: description + ' (callback)',
286-
f: makeFn({useCallbacks: true})
287-
});
288-
}
273+
tests.push({
274+
title: description,
275+
f: makeFn()
276+
});
289277

290-
function makeFn({useCallbacks}) {
278+
function makeFn() {
291279
return function(done) {
292280
const self = this;
293281
self.timeout(5000);
@@ -418,19 +406,10 @@ function addTest(manifest, test, tests) {
418406
});
419407
};
420408

421-
// add nodejs style callback
422-
if(useCallbacks) {
423-
params.push(callback);
424-
}
425-
426409
// resolve test data run
427410
Promise.all(params).then(values => {
428411
const promise = jsonld[fn].apply(null, values);
429-
430-
// promise style
431-
if(!useCallbacks) {
432-
return promise.then(callback.bind(null, null), callback);
433-
}
412+
return promise.then(callback.bind(null, null), callback);
434413
}).catch(err => {
435414
console.error(err);
436415
throw err;

0 commit comments

Comments
 (0)