Chatwoot/app/javascript/widget/store/modules/specs/campaign/mutations.spec.js
Aswin Dev P.S c4837cd7ac
feat: End conversation from widget (#3660)
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Fayaz Ahmed <15716057+fayazara@users.noreply.github.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2022-03-15 22:07:30 +05:30

36 lines
1.1 KiB
JavaScript

import { mutations } from '../../campaign';
import { campaigns } from './data';
jest.mock('widget/store/index.js');
describe('#mutations', () => {
describe('#setCampaigns', () => {
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);
});
});
describe('#setActiveCampaign', () => {
it('set active campaign', () => {
const state = { records: [] };
mutations.setActiveCampaign(state, campaigns[0]);
expect(state.activeCampaign).toEqual(campaigns[0]);
});
});
describe('#setCampaignExecuted', () => {
it('set campaign executed flag', () => {
const state = { records: [], uiFlags: {}, campaignHasExecuted: false };
mutations.setCampaignExecuted(state, true);
expect(state.campaignHasExecuted).toEqual(true);
});
});
});