Extract IIFE into separate function

pull/1/head
Daniel Gasienica 7 years ago
parent 11f98474ba
commit b7b6195cfc

@ -91,7 +91,11 @@ const createRandomMessage = ({ conversationId } = {}) => {
type, type,
}; };
const message = (() => { const message = _createMessage({ commonProperties, conversationId, type });
return Message.initializeSchemaVersion(message);
};
const _createMessage = ({ commonProperties, conversationId, type } = {}) => {
switch (type) { switch (type) {
case 'incoming': case 'incoming':
return Object.assign({}, commonProperties, { return Object.assign({}, commonProperties, {
@ -111,9 +115,6 @@ const createRandomMessage = ({ conversationId } = {}) => {
default: default:
throw new TypeError(`Unknown message type: '${type}'`); throw new TypeError(`Unknown message type: '${type}'`);
} }
})();
return Message.initializeSchemaVersion(message);
}; };
const MEGA_BYTE = 1e6; const MEGA_BYTE = 1e6;

Loading…
Cancel
Save