add tests
This commit is contained in:
parent
a75d372026
commit
64780dee6f
|
@ -0,0 +1,26 @@
|
|||
import { selectServerRequest, selectServerSuccess } from '../actions/server';
|
||||
import { mockedStore } from './mockedStore';
|
||||
import { initialState } from './server';
|
||||
|
||||
describe('test server reducer', () => {
|
||||
it('should return initial state', () => {
|
||||
const state = mockedStore.getState().server;
|
||||
expect(state).toEqual(initialState);
|
||||
});
|
||||
|
||||
it('should return modified store after selectServer', () => {
|
||||
const server = 'https://open.rocket.chat/';
|
||||
mockedStore.dispatch(selectServerRequest(server));
|
||||
const state = mockedStore.getState().server.server;
|
||||
expect(state).toEqual(server);
|
||||
});
|
||||
|
||||
it('should return modified store after selectServerSucess', () => {
|
||||
const serverStr = 'https://mobile.rocket.chat/';
|
||||
const versionStr = '4.1.0';
|
||||
mockedStore.dispatch(selectServerSuccess(serverStr, versionStr));
|
||||
const { server, version } = mockedStore.getState().server;
|
||||
expect(server).toEqual(serverStr);
|
||||
expect(version).toEqual(versionStr);
|
||||
});
|
||||
});
|
|
@ -12,7 +12,7 @@ export interface IServer {
|
|||
changingServer: boolean;
|
||||
}
|
||||
|
||||
const initialState: IServer = {
|
||||
export const initialState: IServer = {
|
||||
connecting: false,
|
||||
connected: false,
|
||||
failure: false,
|
||||
|
|
Loading…
Reference in New Issue