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]);
|
|
|
|
});
|
|
|
|
});
|
2022-03-15 16:37:30 +00:00
|
|
|
|
|
|
|
describe('#setCampaignExecuted', () => {
|
|
|
|
it('set campaign executed flag', () => {
|
|
|
|
const state = { records: [], uiFlags: {}, campaignHasExecuted: false };
|
|
|
|
mutations.setCampaignExecuted(state, true);
|
|
|
|
expect(state.campaignHasExecuted).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
2021-05-10 07:31:00 +00:00
|
|
|
});
|