|
|
|
@ -2,7 +2,7 @@ import reducer from '../soapbox';
|
|
|
|
|
import { Map as ImmutableMap } from 'immutable';
|
|
|
|
|
import * as actions from 'soapbox/actions/soapbox';
|
|
|
|
|
import soapbox from 'soapbox/__fixtures__/soapbox.json';
|
|
|
|
|
import frontend_config from 'soapbox/__fixtures__/admin_api_frontend_config.json';
|
|
|
|
|
import soapboxConfig from 'soapbox/__fixtures__/admin_api_frontend_config.json';
|
|
|
|
|
|
|
|
|
|
describe('soapbox reducer', () => {
|
|
|
|
|
it('should return the initial state', () => {
|
|
|
|
@ -13,28 +13,30 @@ describe('soapbox reducer', () => {
|
|
|
|
|
const state = ImmutableMap({ brandColor: '#354e91' });
|
|
|
|
|
const action = {
|
|
|
|
|
type: actions.SOAPBOX_CONFIG_REQUEST_SUCCESS,
|
|
|
|
|
soapboxConfig: frontend_config,
|
|
|
|
|
soapboxConfig: soapbox,
|
|
|
|
|
};
|
|
|
|
|
expect(reducer(state, action).toJS()).toMatchObject({
|
|
|
|
|
brandColor: '#254f92',
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should handle SOAPBOX_CONFIG_REQUEST_FAIL', () => {
|
|
|
|
|
const state = ImmutableMap({ skipAlert: false });
|
|
|
|
|
const action = {
|
|
|
|
|
type: actions.SOAPBOX_CONFIG_REQUEST_FAIL,
|
|
|
|
|
};
|
|
|
|
|
expect(reducer(state, action).toJS()).toMatchObject({
|
|
|
|
|
skipAlert: true,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
// it('should handle SOAPBOX_CONFIG_REQUEST_FAIL', () => {
|
|
|
|
|
// const state = ImmutableMap({ skipAlert: false, brandColor: '#354e91' });
|
|
|
|
|
// const action = {
|
|
|
|
|
// type: actions.SOAPBOX_CONFIG_REQUEST_FAIL,
|
|
|
|
|
// skipAlert: true,
|
|
|
|
|
// };
|
|
|
|
|
// expect(reducer(state, action).toJS()).toMatchObject({
|
|
|
|
|
// skipAlert: true,
|
|
|
|
|
// brandColor: '#354e91',
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
it('should handle SOAPBOX_POST_SUCCESS', () => {
|
|
|
|
|
const state = ImmutableMap({ brandColor: '#354e91' });
|
|
|
|
|
const action = {
|
|
|
|
|
type: actions.SOAPBOX_POST_SUCCESS,
|
|
|
|
|
brandColor: soapbox.get('brandColor'),
|
|
|
|
|
soapboxConfig: soapboxConfig,
|
|
|
|
|
};
|
|
|
|
|
expect(reducer(state, action).toJS()).toMatchObject({
|
|
|
|
|
brandColor: '#254f92',
|
|
|
|
|