Useful tools for unit test: Just pending for callback.
npm install pedding
CommonJS
const { pending } = require('pedding');
it('should request two resources', done => {
done = pending(2, done);
http.get('http://fengmk2.github.com', res => {
done();
});
http.get('http://www.taobao.com', res => {
done();
});
});
ESM and TypeScript
import { pending } from 'pedding';
it('should request two resources', done => {
done = pending(2, done);
http.get('http://fengmk2.github.com', res => {
done();
});
http.get('http://www.taobao.com', res => {
done();
});
});
Made with contributors-img.