Repository URL to install this package:
|
Version:
3.7.0 ▾
|
import { createReducer } from './abReducer';
import { ActionTypes } from '../actions/abActions';
import { initialState } from '../index';
describe('Ab Reducer', () => {
test('should return the initial state', () => {
expect(createReducer().ab(undefined, {})).toEqual(initialState);
});
test('CHOOSE_EXPERIMENT', () => {
const name = 'experimentFirst';
const variant = 'variantA';
const finalState = {
...initialState,
experiments: {
[name]: { variant },
},
};
const payload = {
name,
variant,
};
expect(createReducer().ab(undefined, { type: ActionTypes.CHOOSE_EXPERIMENT, payload })).toEqual(finalState);
});
});