Use rewire to test unexported functions
This commit is contained in:
parent
0dcfcbbafd
commit
6c7bf0d81a
5 changed files with 13 additions and 3 deletions
|
@ -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';
|
||||
[
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue