Files
dolt/js/src/async_test.js
Erik Arvidsson 4d253ae435 JS style: Arrow functions
Pick up the following style rules

arrow-body-style
arrow-parens
arrow-spacing
prefer-arrow-callback
2016-01-20 15:49:59 -08:00

19 lines
313 B
JavaScript

// @flow
import {test as mtest} from 'mocha';
export default function test(n: string, f: () => ?Promise) {
mtest(n, (done) => {
try {
const p = f();
if (p instanceof Promise) {
p.then(done, done);
} else {
done();
}
} catch (ex) {
done(ex);
}
});
}