Use rewire to test unexported functions

This commit is contained in:
Ken-Håvard Lieng 2017-06-23 03:06:44 +02:00
parent 0dcfcbbafd
commit 6c7bf0d81a
5 changed files with 13 additions and 3 deletions

View file

@ -1,5 +1,5 @@
import { Map, fromJS } from 'immutable';
import reducer, { broadcast, getMessageTab } from '../messages';
import reducer, { broadcast } from '../messages';
import * as actions from '../actions';
import appReducer from '../app';
@ -178,6 +178,8 @@ describe('message reducer', () => {
});
describe('getMessageTab()', () => {
const getMessageTab = reducer.__get__('getMessageTab');
it('returns the correct tab', () => {
const srv = 'chat.freenode.net';
[

View file

@ -117,7 +117,7 @@ function initMessage(message, tab, state) {
return message;
}
export function getMessageTab(server, to) {
function getMessageTab(server, to) {
if (!to || to === '*' || (!isChannel(to) && to.indexOf('.') !== -1)) {
return server;
}