2021-05-10 07:31:00 +00:00
|
|
|
import { mutations } from '../../campaign';
|
|
|
|
import { campaigns } from './data';
|
2021-06-15 14:39:42 +00:00
|
|
|
jest.mock('widget/store/index.js');
|
2021-05-10 07:31:00 +00:00
|
|
|
describe('#mutations', () => {
|
2021-05-18 06:45:23 +00:00
|
|
|
describe('#setCampaigns', () => {
|
2021-05-10 07:31:00 +00:00
|
|
|
it('set campaign records', () => {
|
|
|
|
const state = { records: [] };
|
|
|
|
mutations.setCampaigns(state, campaigns);
|
|
|
|
expect(state.records).toEqual(campaigns);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#setError', () => {
|
|
|
|
it('set error flag', () => {
|
|
|
|
const state = { records: [], uiFlags: {} };
|
|
|
|
mutations.setError(state, true);
|
|
|
|
expect(state.uiFlags.isError).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-06-15 14:39:42 +00:00
|
|
|
describe('#setActiveCampaign', () => {
|
|
|
|
it('set active campaign', () => {
|
|
|
|
const state = { records: [] };
|
|
|
|
mutations.setActiveCampaign(state, campaigns[0]);
|
|
|
|
expect(state.activeCampaign).toEqual(campaigns[0]);
|
|
|
|
});
|
|
|
|
});
|
2021-05-10 07:31:00 +00:00
|
|
|
});
|