Stopped aliasing action types
This commit is contained in:
parent
537649f166
commit
71c0707a90
21 changed files with 143 additions and 141 deletions
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
import {bindClientFunc} from './helpers.js';
|
||||
import Client from 'client/client_instance';
|
||||
import {ChannelsTypes as types} from 'constants';
|
||||
import {ChannelsTypes} from 'constants';
|
||||
|
||||
export function selectChannel(channel) {
|
||||
return {
|
||||
type: types.SELECT_CHANNEL,
|
||||
type: ChannelsTypes.SELECT_CHANNEL,
|
||||
channelId: channel.id
|
||||
};
|
||||
}
|
||||
|
|
@ -15,8 +15,8 @@ export function selectChannel(channel) {
|
|||
export function fetchChannels() {
|
||||
return bindClientFunc(
|
||||
Client.fetchChannels,
|
||||
types.FETCH_CHANNELS_REQUEST,
|
||||
types.FETCH_CHANNELS_SUCCESS,
|
||||
types.FETCH_CHANNELS_FAILURE
|
||||
ChannelsTypes.FETCH_CHANNELS_REQUEST,
|
||||
ChannelsTypes.FETCH_CHANNELS_SUCCESS,
|
||||
ChannelsTypes.FETCH_CHANNELS_FAILURE
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
|
||||
import {requestData, requestSuccess, requestFailure} from './helpers.js';
|
||||
import {AsyncStorage} from 'react-native';
|
||||
import {DeviceTypes as types} from 'constants';
|
||||
import {DeviceTypes} from 'constants';
|
||||
|
||||
function fetchDevice() {
|
||||
return async (dispatch) => {
|
||||
try {
|
||||
dispatch(requestData(types.DEVICE_REQUEST));
|
||||
dispatch(requestData(DeviceTypes.DEVICE_REQUEST));
|
||||
const json = await AsyncStorage.getItem('basic_info');
|
||||
dispatch(requestSuccess(types.DEVICE_SUCCESS, JSON.parse(json)));
|
||||
dispatch(requestSuccess(DeviceTypes.DEVICE_SUCCESS, JSON.parse(json)));
|
||||
} catch (err) {
|
||||
dispatch(requestFailure(types.DEVICE_FAILURE, {msg: 'failed to load local storage'}));
|
||||
dispatch(requestFailure(DeviceTypes.DEVICE_FAILURE, {msg: 'failed to load local storage'}));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,32 +3,32 @@
|
|||
|
||||
import Client from 'client/client_instance.js';
|
||||
import {bindClientFunc} from './helpers.js';
|
||||
import {GeneralTypes as types} from 'constants';
|
||||
import {GeneralTypes} from 'constants';
|
||||
|
||||
export function getPing() {
|
||||
return bindClientFunc(
|
||||
Client.getPing,
|
||||
types.PING_REQUEST,
|
||||
types.PING_SUCCESS,
|
||||
types.PING_FAILURE
|
||||
GeneralTypes.PING_REQUEST,
|
||||
GeneralTypes.PING_SUCCESS,
|
||||
GeneralTypes.PING_FAILURE
|
||||
);
|
||||
}
|
||||
|
||||
export function getClientConfig() {
|
||||
return bindClientFunc(
|
||||
Client.getClientConfig,
|
||||
types.CLIENT_CONFIG_REQUEST,
|
||||
types.CLIENT_CONFIG_SUCCESS,
|
||||
types.CLIENT_CONFIG_FAILURE
|
||||
GeneralTypes.CLIENT_CONFIG_REQUEST,
|
||||
GeneralTypes.CLIENT_CONFIG_SUCCESS,
|
||||
GeneralTypes.CLIENT_CONFIG_FAILURE
|
||||
);
|
||||
}
|
||||
|
||||
export function logClientError(message, level = 'ERROR') {
|
||||
return bindClientFunc(
|
||||
Client.logClientError,
|
||||
types.LOG_CLIENT_ERROR_REQUEST,
|
||||
types.LOG_CLIENT_ERROR_SUCCESS,
|
||||
types.LOG_CLIENT_ERROR_FAILURE,
|
||||
GeneralTypes.LOG_CLIENT_ERROR_REQUEST,
|
||||
GeneralTypes.LOG_CLIENT_ERROR_SUCCESS,
|
||||
GeneralTypes.LOG_CLIENT_ERROR_FAILURE,
|
||||
message,
|
||||
level
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import {LoginTypes as types} from 'constants';
|
||||
import {LoginTypes} from 'constants';
|
||||
import Client from 'client/client_instance';
|
||||
import {bindClientFunc} from 'actions/helpers.js';
|
||||
|
||||
export function login(loginId, password, mfaToken = '') {
|
||||
return bindClientFunc(
|
||||
Client.login,
|
||||
types.LOGIN_REQUEST,
|
||||
types.LOGIN_SUCCESS,
|
||||
types.LOGIN_FAILURE,
|
||||
LoginTypes.LOGIN_REQUEST,
|
||||
LoginTypes.LOGIN_SUCCESS,
|
||||
LoginTypes.LOGIN_FAILURE,
|
||||
loginId,
|
||||
password,
|
||||
mfaToken
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import {LogoutTypes as types} from 'constants';
|
||||
import {LogoutTypes} from 'constants';
|
||||
import Client from 'client/client_instance';
|
||||
import {bindClientFunc} from 'actions/helpers.js';
|
||||
|
||||
export function logout() {
|
||||
return bindClientFunc(
|
||||
Client.logout,
|
||||
types.LOGOUT_REQUEST,
|
||||
types.LOGOUT_SUCCESS,
|
||||
types.LOGOUT_FAILURE
|
||||
LogoutTypes.LOGOUT_REQUEST,
|
||||
LogoutTypes.LOGOUT_SUCCESS,
|
||||
LogoutTypes.LOGOUT_FAILURE
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
import {bindClientFunc} from './helpers.js';
|
||||
import Client from 'client/client_instance';
|
||||
import {TeamsTypes as types} from 'constants';
|
||||
import {TeamsTypes} from 'constants';
|
||||
|
||||
export function selectTeam(team) {
|
||||
Client.setTeamId(team.id);
|
||||
return {
|
||||
type: types.SELECT_TEAM,
|
||||
type: TeamsTypes.SELECT_TEAM,
|
||||
teamId: team.id
|
||||
};
|
||||
}
|
||||
|
|
@ -16,8 +16,8 @@ export function selectTeam(team) {
|
|||
export function fetchTeams() {
|
||||
return bindClientFunc(
|
||||
Client.fetchTeams,
|
||||
types.FETCH_TEAMS_REQUEST,
|
||||
types.FETCH_TEAMS_SUCCESS,
|
||||
types.FETCH_TEAMS_FAILURE
|
||||
TeamsTypes.FETCH_TEAMS_REQUEST,
|
||||
TeamsTypes.FETCH_TEAMS_SUCCESS,
|
||||
TeamsTypes.FETCH_TEAMS_FAILURE
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ import * as TeamsTypes from './teams';
|
|||
import * as PostsTypes from './posts';
|
||||
|
||||
export {
|
||||
DeviceTypes,
|
||||
GeneralTypes,
|
||||
LoginTypes,
|
||||
LogoutTypes,
|
||||
TeamsTypes,
|
||||
ChannelsTypes,
|
||||
PostsTypes
|
||||
DeviceTypes,
|
||||
GeneralTypes,
|
||||
LoginTypes,
|
||||
LogoutTypes,
|
||||
TeamsTypes,
|
||||
ChannelsTypes,
|
||||
PostsTypes
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import _ from 'lodash';
|
||||
import {ChannelsTypes, LogoutTypes} from 'constants';
|
||||
const types = {...ChannelsTypes, ...LogoutTypes};
|
||||
|
||||
export const initState = {
|
||||
status: 'not fetched',
|
||||
|
|
@ -17,28 +19,28 @@ function zipById(channels) {
|
|||
export default function reduceChannels(state = initState, action) {
|
||||
switch (action.type) {
|
||||
|
||||
case types.SELECT_CHANNEL:
|
||||
case ChannelsTypes.SELECT_CHANNEL:
|
||||
return {...state,
|
||||
currentChannelId: action.channelId
|
||||
};
|
||||
|
||||
case types.FETCH_CHANNELS_REQUEST:
|
||||
case ChannelsTypes.FETCH_CHANNELS_REQUEST:
|
||||
return {...state,
|
||||
status: 'fetching',
|
||||
error: null
|
||||
};
|
||||
case types.FETCH_CHANNELS_SUCCESS:
|
||||
case ChannelsTypes.FETCH_CHANNELS_SUCCESS:
|
||||
return {...state,
|
||||
status: 'fetched',
|
||||
data: zipById(action.data.channels)
|
||||
};
|
||||
case types.FETCH_CHANNELS_FAILURE:
|
||||
case ChannelsTypes.FETCH_CHANNELS_FAILURE:
|
||||
return {...state,
|
||||
status: 'failed',
|
||||
error: action.error
|
||||
};
|
||||
|
||||
case types.LOGOUT_SUCCESS:
|
||||
case LogoutTypes.LOGOUT_SUCCESS:
|
||||
return initState;
|
||||
default:
|
||||
return state;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
// See License.txt for license information.
|
||||
|
||||
import {handle, initialState} from './helpers.js';
|
||||
import {DeviceTypes as types} from 'constants';
|
||||
import {DeviceTypes} from 'constants';
|
||||
export const initState = initialState();
|
||||
|
||||
export default function device(state = initState, action) {
|
||||
return handle(
|
||||
types.DEVICE_REQUEST,
|
||||
types.DEVICE_SUCCESS,
|
||||
types.DEVICE_FAILURE,
|
||||
state,
|
||||
action);
|
||||
DeviceTypes.DEVICE_REQUEST,
|
||||
DeviceTypes.DEVICE_SUCCESS,
|
||||
DeviceTypes.DEVICE_FAILURE,
|
||||
state,
|
||||
action
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import {combineReducers} from 'redux';
|
||||
import {initialState, handle} from './helpers.js';
|
||||
import {GeneralTypes as types} from 'constants';
|
||||
import {GeneralTypes} from 'constants';
|
||||
|
||||
export const initState = initialState();
|
||||
|
||||
|
|
@ -11,20 +11,22 @@ export const initState = initialState();
|
|||
// We can't do so until it's extracted into its own store with more reducers
|
||||
export function clientConfig(state = initState, action) {
|
||||
return handle(
|
||||
types.CLIENT_CONFIG_REQUEST,
|
||||
types.CLIENT_CONFIG_SUCCESS,
|
||||
types.CLIENT_CONFIG_FAILURE,
|
||||
state,
|
||||
action);
|
||||
GeneralTypes.CLIENT_CONFIG_REQUEST,
|
||||
GeneralTypes.CLIENT_CONFIG_SUCCESS,
|
||||
GeneralTypes.CLIENT_CONFIG_FAILURE,
|
||||
state,
|
||||
action
|
||||
);
|
||||
}
|
||||
|
||||
export function ping(state = initialState(), action) {
|
||||
return handle(
|
||||
types.PING_REQUEST,
|
||||
types.PING_SUCCESS,
|
||||
types.PING_FAILURE,
|
||||
state,
|
||||
action);
|
||||
GeneralTypes.PING_REQUEST,
|
||||
GeneralTypes.PING_SUCCESS,
|
||||
GeneralTypes.PING_FAILURE,
|
||||
state,
|
||||
action
|
||||
);
|
||||
}
|
||||
|
||||
export default combineReducers({
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// See License.txt for license information.
|
||||
|
||||
import {LoginTypes, LogoutTypes} from 'constants';
|
||||
const types = {...LoginTypes, ...LogoutTypes};
|
||||
|
||||
export const initState = {
|
||||
status: 'not fetched',
|
||||
|
|
@ -12,22 +11,22 @@ export const initState = {
|
|||
export default function reduceLogin(state = initState, action) {
|
||||
switch (action.type) {
|
||||
|
||||
case types.LOGIN_REQUEST:
|
||||
case LoginTypes.LOGIN_REQUEST:
|
||||
return {...state,
|
||||
status: 'fetching',
|
||||
error: null
|
||||
};
|
||||
case types.LOGIN_SUCCESS:
|
||||
case LoginTypes.LOGIN_SUCCESS:
|
||||
return {...state,
|
||||
status: 'fetched'
|
||||
};
|
||||
case types.LOGIN_FAILURE:
|
||||
case LoginTypes.LOGIN_FAILURE:
|
||||
return {...state,
|
||||
status: 'failed',
|
||||
error: action.error
|
||||
};
|
||||
|
||||
case types.LOGOUT_SUCCESS:
|
||||
case LogoutTypes.LOGOUT_SUCCESS:
|
||||
return initState;
|
||||
default:
|
||||
return state;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import {LogoutTypes as types} from 'constants';
|
||||
import {LogoutTypes} from 'constants';
|
||||
|
||||
export const initState = {
|
||||
status: 'not fetched',
|
||||
|
|
@ -10,16 +10,16 @@ export const initState = {
|
|||
|
||||
export default function reduceLogout(state = initState, action) {
|
||||
switch (action.type) {
|
||||
case types.LOGOUT_REQUEST:
|
||||
case LogoutTypes.LOGOUT_REQUEST:
|
||||
return {...state,
|
||||
status: 'fetching',
|
||||
error: null
|
||||
};
|
||||
case types.LOGOUT_SUCCESS:
|
||||
case LogoutTypes.LOGOUT_SUCCESS:
|
||||
return {...state,
|
||||
status: 'fetched'
|
||||
};
|
||||
case types.LOGOUT_FAILURE:
|
||||
case LogoutTypes.LOGOUT_FAILURE:
|
||||
return {...state,
|
||||
status: 'failed',
|
||||
error: action.error
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// See License.txt for license information.
|
||||
|
||||
import {PostsTypes, LogoutTypes} from 'constants';
|
||||
const types = {...PostsTypes, ...LogoutTypes};
|
||||
|
||||
export const initState = {
|
||||
status: 'not fetched',
|
||||
|
|
@ -13,23 +12,23 @@ export const initState = {
|
|||
export default function reducePosts(state = initState, action) {
|
||||
switch (action.type) {
|
||||
|
||||
case types.FETCH_POSTS_REQUEST:
|
||||
case PostsTypes.FETCH_POSTS_REQUEST:
|
||||
return {...state,
|
||||
status: 'fetching',
|
||||
error: null
|
||||
};
|
||||
case types.FETCH_POSTS_SUCCESS:
|
||||
case PostsTypes.FETCH_POSTS_SUCCESS:
|
||||
return {...state,
|
||||
status: 'fetched',
|
||||
data: action.data.posts
|
||||
};
|
||||
case types.FETCH_POSTS_FAILURE:
|
||||
case PostsTypes.FETCH_POSTS_FAILURE:
|
||||
return {...state,
|
||||
status: 'failed',
|
||||
error: action.error
|
||||
};
|
||||
|
||||
case types.LOGOUT_SUCCESS:
|
||||
case LogoutTypes.LOGOUT_SUCCESS:
|
||||
return initState;
|
||||
default:
|
||||
return state;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// See License.txt for license information.
|
||||
|
||||
import {TeamsTypes, LogoutTypes} from 'constants';
|
||||
const types = {...TeamsTypes, ...LogoutTypes};
|
||||
|
||||
export const initState = {
|
||||
status: 'not fetched',
|
||||
|
|
@ -14,28 +13,28 @@ export const initState = {
|
|||
export default function reduceTeams(state = initState, action) {
|
||||
switch (action.type) {
|
||||
|
||||
case types.SELECT_TEAM:
|
||||
case TeamsTypes.SELECT_TEAM:
|
||||
return {...state,
|
||||
currentTeamId: action.teamId
|
||||
};
|
||||
|
||||
case types.FETCH_TEAMS_REQUEST:
|
||||
case TeamsTypes.FETCH_TEAMS_REQUEST:
|
||||
return {...state,
|
||||
status: 'fetching',
|
||||
error: null
|
||||
};
|
||||
case types.FETCH_TEAMS_SUCCESS:
|
||||
case TeamsTypes.FETCH_TEAMS_SUCCESS:
|
||||
return {...state,
|
||||
status: 'fetched',
|
||||
data: action.data
|
||||
};
|
||||
case types.FETCH_TEAMS_FAILURE:
|
||||
case TeamsTypes.FETCH_TEAMS_FAILURE:
|
||||
return {...state,
|
||||
status: 'failed',
|
||||
error: action.error
|
||||
};
|
||||
|
||||
case types.LOGOUT_SUCCESS:
|
||||
case LogoutTypes.LOGOUT_SUCCESS:
|
||||
return initState;
|
||||
default:
|
||||
return state;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import reduceChannels, {initState} from 'reducers/channels';
|
||||
import {ChannelsTypes as types} from 'constants';
|
||||
import {ChannelsTypes} from 'constants';
|
||||
|
||||
describe('channels reducer', () => {
|
||||
describe('Init', () => {
|
||||
|
|
@ -20,12 +20,12 @@ describe('channels reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.SELECT_CHANNEL}`, () => {
|
||||
describe(`when ${ChannelsTypes.SELECT_CHANNEL}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceChannels(store, {
|
||||
type: types.SELECT_CHANNEL,
|
||||
type: ChannelsTypes.SELECT_CHANNEL,
|
||||
channelId: '1'
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
@ -37,12 +37,12 @@ describe('channels reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.FETCH_CHANNELS_REQUEST}`, () => {
|
||||
describe(`when ${ChannelsTypes.FETCH_CHANNELS_REQUEST}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceChannels(store, {
|
||||
type: types.FETCH_CHANNELS_REQUEST
|
||||
type: ChannelsTypes.FETCH_CHANNELS_REQUEST
|
||||
});
|
||||
expectedStore = {
|
||||
...initState,
|
||||
|
|
@ -53,12 +53,12 @@ describe('channels reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.FETCH_CHANNELS_SUCCESS}`, () => {
|
||||
describe(`when ${ChannelsTypes.FETCH_CHANNELS_SUCCESS}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceChannels(store, {
|
||||
type: types.FETCH_CHANNELS_SUCCESS,
|
||||
type: ChannelsTypes.FETCH_CHANNELS_SUCCESS,
|
||||
data: {channels: [{id: '1', attr: 'attr'}]}
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
@ -71,14 +71,14 @@ describe('channels reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.FETCH_CHANNELS_FAILURE}`, () => {
|
||||
describe(`when ${ChannelsTypes.FETCH_CHANNELS_FAILURE}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
let error;
|
||||
before(() => {
|
||||
error = {id: 'the.error.id', message: 'Something went wrong'};
|
||||
store = reduceChannels(store, {
|
||||
type: types.FETCH_CHANNELS_FAILURE,
|
||||
type: ChannelsTypes.FETCH_CHANNELS_FAILURE,
|
||||
error
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import reduceDevice, {initState} from 'reducers/device';
|
||||
import {DeviceTypes as types} from 'constants';
|
||||
import {DeviceTypes} from 'constants';
|
||||
|
||||
describe('device reducer', () => {
|
||||
describe('Init', () => {
|
||||
|
|
@ -20,12 +20,12 @@ describe('device reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.DEVICE_REQUEST}`, () => {
|
||||
describe(`when ${DeviceTypes.DEVICE_REQUEST}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceDevice(store, {
|
||||
type: types.DEVICE_REQUEST
|
||||
type: DeviceTypes.DEVICE_REQUEST
|
||||
});
|
||||
expectedStore = {
|
||||
...initState,
|
||||
|
|
@ -36,13 +36,13 @@ describe('device reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.DEVICE_SUCCESS}`, () => {
|
||||
describe(`when ${DeviceTypes.DEVICE_SUCCESS}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
const data = {some: 'data'};
|
||||
before(() => {
|
||||
store = reduceDevice(store, {
|
||||
type: types.DEVICE_SUCCESS,
|
||||
type: DeviceTypes.DEVICE_SUCCESS,
|
||||
data
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
@ -55,14 +55,14 @@ describe('device reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.DEVICE_FAILURE}`, () => {
|
||||
describe(`when ${DeviceTypes.DEVICE_FAILURE}`, () => {
|
||||
let store;
|
||||
let error;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
error = {id: 'the.error.id', message: 'Something went wrong'};
|
||||
store = reduceDevice(store, {
|
||||
type: types.DEVICE_FAILURE,
|
||||
type: DeviceTypes.DEVICE_FAILURE,
|
||||
error
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import reduceGeneral, {initState} from 'reducers/general';
|
||||
import {GeneralTypes as types} from 'constants';
|
||||
import {GeneralTypes} from 'constants';
|
||||
|
||||
const combinedState = {
|
||||
clientConfig: {...initState},
|
||||
|
|
@ -26,12 +26,12 @@ describe('general reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.PING_REQUEST}`, () => {
|
||||
describe(`when ${GeneralTypes.PING_REQUEST}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceGeneral(store, {
|
||||
type: types.PING_REQUEST
|
||||
type: GeneralTypes.PING_REQUEST
|
||||
});
|
||||
expectedStore = {
|
||||
...combinedState,
|
||||
|
|
@ -45,13 +45,13 @@ describe('general reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.PING_SUCCESS}`, () => {
|
||||
describe(`when ${GeneralTypes.PING_SUCCESS}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
const data = {some: 'data'};
|
||||
before(() => {
|
||||
store = reduceGeneral(store, {
|
||||
type: types.PING_SUCCESS,
|
||||
type: GeneralTypes.PING_SUCCESS,
|
||||
data
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
@ -66,14 +66,14 @@ describe('general reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.PING_FAILURE}`, () => {
|
||||
describe(`when ${GeneralTypes.PING_FAILURE}`, () => {
|
||||
let store;
|
||||
let error;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
error = {id: 'the.error.id', message: 'Something went wrong'};
|
||||
store = reduceGeneral(store, {
|
||||
type: types.PING_FAILURE,
|
||||
type: GeneralTypes.PING_FAILURE,
|
||||
error
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
@ -104,12 +104,12 @@ describe('general reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.CLIENT_CONFIG_REQUEST}`, () => {
|
||||
describe(`when ${GeneralTypes.CLIENT_CONFIG_REQUEST}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceGeneral(store, {
|
||||
type: types.CLIENT_CONFIG_REQUEST
|
||||
type: GeneralTypes.CLIENT_CONFIG_REQUEST
|
||||
});
|
||||
expectedStore = {
|
||||
...combinedState,
|
||||
|
|
@ -123,13 +123,13 @@ describe('general reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.CLIENT_CONFIG_SUCCESS}`, () => {
|
||||
describe(`when ${GeneralTypes.CLIENT_CONFIG_SUCCESS}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
const data = {some: 'data'};
|
||||
before(() => {
|
||||
store = reduceGeneral(store, {
|
||||
type: types.CLIENT_CONFIG_SUCCESS,
|
||||
type: GeneralTypes.CLIENT_CONFIG_SUCCESS,
|
||||
data
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
@ -144,14 +144,14 @@ describe('general reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.CLIENT_CONFIG_FAILURE}`, () => {
|
||||
describe(`when ${GeneralTypes.CLIENT_CONFIG_FAILURE}`, () => {
|
||||
let store;
|
||||
let error;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
error = {id: 'the.error.id', message: 'Something went wrong'};
|
||||
store = reduceGeneral(store, {
|
||||
type: types.CLIENT_CONFIG_FAILURE,
|
||||
type: GeneralTypes.CLIENT_CONFIG_FAILURE,
|
||||
error
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import reduceLogin, {initState} from 'reducers/login';
|
||||
import {LoginTypes as types} from 'constants';
|
||||
import {LoginTypes} from 'constants';
|
||||
|
||||
describe('login reducer', () => {
|
||||
describe('Init', () => {
|
||||
|
|
@ -20,12 +20,12 @@ describe('login reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.LOGIN_REQUEST}`, () => {
|
||||
describe(`when ${LoginTypes.LOGIN_REQUEST}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceLogin(store, {
|
||||
type: types.LOGIN_REQUEST
|
||||
type: LoginTypes.LOGIN_REQUEST
|
||||
});
|
||||
expectedStore = {
|
||||
...initState,
|
||||
|
|
@ -36,12 +36,12 @@ describe('login reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.LOGIN_SUCCESS}`, () => {
|
||||
describe(`when ${LoginTypes.LOGIN_SUCCESS}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceLogin(store, {
|
||||
type: types.LOGIN_SUCCESS
|
||||
type: LoginTypes.LOGIN_SUCCESS
|
||||
});
|
||||
expectedStore = {
|
||||
...initState,
|
||||
|
|
@ -52,14 +52,14 @@ describe('login reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.LOGIN_FAILURE}`, () => {
|
||||
describe(`when ${LoginTypes.LOGIN_FAILURE}`, () => {
|
||||
let store;
|
||||
let error;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
error = {id: 'the.error.id', message: 'Something went wrong'};
|
||||
store = reduceLogin(store, {
|
||||
type: types.LOGIN_FAILURE,
|
||||
type: LoginTypes.LOGIN_FAILURE,
|
||||
error
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import reduceLogout, {initState} from 'reducers/logout';
|
||||
import {LogoutTypes as types} from 'constants';
|
||||
import {LogoutTypes} from 'constants';
|
||||
|
||||
describe('logout reducer', () => {
|
||||
describe('Init', () => {
|
||||
|
|
@ -20,12 +20,12 @@ describe('logout reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.LOGOUT_REQUEST}`, () => {
|
||||
describe(`when ${LogoutTypes.LOGOUT_REQUEST}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceLogout(store, {
|
||||
type: types.LOGOUT_REQUEST
|
||||
type: LogoutTypes.LOGOUT_REQUEST
|
||||
});
|
||||
expectedStore = {
|
||||
...initState,
|
||||
|
|
@ -36,12 +36,12 @@ describe('logout reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.LOGOUT_SUCCESS}`, () => {
|
||||
describe(`when ${LogoutTypes.LOGOUT_SUCCESS}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceLogout(store, {
|
||||
type: types.LOGOUT_SUCCESS
|
||||
type: LogoutTypes.LOGOUT_SUCCESS
|
||||
});
|
||||
expectedStore = {
|
||||
...initState,
|
||||
|
|
@ -52,14 +52,14 @@ describe('logout reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.LOGOUT_FAILURE}`, () => {
|
||||
describe(`when ${LogoutTypes.LOGOUT_FAILURE}`, () => {
|
||||
let store;
|
||||
let error;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
error = {id: 'the.error.id', message: 'Something went wrong'};
|
||||
store = reduceLogout(store, {
|
||||
type: types.LOGOUT_FAILURE,
|
||||
type: LogoutTypes.LOGOUT_FAILURE,
|
||||
error
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import reducePosts, {initState} from 'reducers/posts';
|
||||
import {PostsTypes as types} from 'constants';
|
||||
import {PostsTypes} from 'constants';
|
||||
|
||||
describe('posts reducer', () => {
|
||||
describe('Init', () => {
|
||||
|
|
@ -20,12 +20,12 @@ describe('posts reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.FETCH_POSTS_REQUEST}`, () => {
|
||||
describe(`when ${PostsTypes.FETCH_POSTS_REQUEST}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reducePosts(store, {
|
||||
type: types.FETCH_POSTS_REQUEST
|
||||
type: PostsTypes.FETCH_POSTS_REQUEST
|
||||
});
|
||||
expectedStore = {
|
||||
...initState,
|
||||
|
|
@ -36,13 +36,13 @@ describe('posts reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.FETCH_POSTS_SUCCESS}`, () => {
|
||||
describe(`when ${PostsTypes.FETCH_POSTS_SUCCESS}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
const data = {id: '1', attrs: 'attrs'};
|
||||
before(() => {
|
||||
store = reducePosts(store, {
|
||||
type: types.FETCH_POSTS_SUCCESS,
|
||||
type: PostsTypes.FETCH_POSTS_SUCCESS,
|
||||
data: {
|
||||
posts: data
|
||||
}
|
||||
|
|
@ -57,14 +57,14 @@ describe('posts reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.FETCH_POSTS_FAILURE}`, () => {
|
||||
describe(`when ${PostsTypes.FETCH_POSTS_FAILURE}`, () => {
|
||||
let store;
|
||||
let error;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
error = {id: 'the.error.id', message: 'Something went wrong'};
|
||||
store = reducePosts(store, {
|
||||
type: types.FETCH_POSTS_FAILURE,
|
||||
type: PostsTypes.FETCH_POSTS_FAILURE,
|
||||
error
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import reduceTeams, {initState} from 'reducers/teams';
|
||||
import {TeamsTypes as types} from 'constants';
|
||||
import {TeamsTypes} from 'constants';
|
||||
|
||||
describe('teams reducer', () => {
|
||||
describe('Init', () => {
|
||||
|
|
@ -20,12 +20,12 @@ describe('teams reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.SELECT_TEAM}`, () => {
|
||||
describe(`when ${TeamsTypes.SELECT_TEAM}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceTeams(store, {
|
||||
type: types.SELECT_TEAM,
|
||||
type: TeamsTypes.SELECT_TEAM,
|
||||
teamId: '1'
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
@ -37,12 +37,12 @@ describe('teams reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.FETCH_TEAMS_REQUEST}`, () => {
|
||||
describe(`when ${TeamsTypes.FETCH_TEAMS_REQUEST}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceTeams(store, {
|
||||
type: types.FETCH_TEAMS_REQUEST
|
||||
type: TeamsTypes.FETCH_TEAMS_REQUEST
|
||||
});
|
||||
expectedStore = {
|
||||
...initState,
|
||||
|
|
@ -53,13 +53,13 @@ describe('teams reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.FETCH_TEAMS_SUCCESS}`, () => {
|
||||
describe(`when ${TeamsTypes.FETCH_TEAMS_SUCCESS}`, () => {
|
||||
let store;
|
||||
const data = {some: 'thing'};
|
||||
let expectedStore;
|
||||
before(() => {
|
||||
store = reduceTeams(store, {
|
||||
type: types.FETCH_TEAMS_SUCCESS,
|
||||
type: TeamsTypes.FETCH_TEAMS_SUCCESS,
|
||||
data
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
@ -72,14 +72,14 @@ describe('teams reducer', () => {
|
|||
assert.deepEqual(store, expectedStore);
|
||||
});
|
||||
});
|
||||
describe(`when ${types.FETCH_TEAMS_FAILURE}`, () => {
|
||||
describe(`when ${TeamsTypes.FETCH_TEAMS_FAILURE}`, () => {
|
||||
let store;
|
||||
let expectedStore;
|
||||
let error;
|
||||
before(() => {
|
||||
error = {id: 'the.error.id', message: 'Something went wrong'};
|
||||
store = reduceTeams(store, {
|
||||
type: types.FETCH_TEAMS_FAILURE,
|
||||
type: TeamsTypes.FETCH_TEAMS_FAILURE,
|
||||
error
|
||||
});
|
||||
expectedStore = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue