Refactored bootstrap-socket API for testability
- this makes it much easier to stub this behaviour in tests - also makes more sense
This commit is contained in:
parent
ab291cb922
commit
a01d44fa6a
@ -1 +1 @@
|
|||||||
module.exports = require('./lib/connect-and-send');
|
module.exports = require('./lib/bootstrap-socket');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module.exports = (socketAddress, logging, message) => {
|
module.exports.connectAndSend = (socketAddress, logging, message) => {
|
||||||
// Very basic guard against bad calls
|
// Very basic guard against bad calls
|
||||||
if (!socketAddress || !socketAddress.host || !socketAddress.port || !logging || !logging.info || !logging.warn || !message) {
|
if (!socketAddress || !socketAddress.host || !socketAddress.port || !logging || !logging.info || !logging.warn || !message) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
@ -2,10 +2,10 @@
|
|||||||
// const testUtils = require('./utils');
|
// const testUtils = require('./utils');
|
||||||
require('./utils');
|
require('./utils');
|
||||||
|
|
||||||
const connectAndSend = require('../lib/connect-and-send');
|
const bootstrapSocket = require('../lib/bootstrap-socket');
|
||||||
|
|
||||||
describe('Connect and send', function () {
|
describe('Connect and send', function () {
|
||||||
it('Resolves a promise for a bad call', function () {
|
it('Resolves a promise for a bad call', function () {
|
||||||
connectAndSend().should.be.fulfilled();
|
bootstrapSocket.connectAndSend().should.be.fulfilled();
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user