fb2f3ff89f
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
36 lines
1 KiB
JavaScript
36 lines
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('#setHasFetched', () => {
|
|
it('set fetched flag', () => {
|
|
const state = { records: [], uiFlags: {} };
|
|
mutations.setHasFetched(state, true);
|
|
expect(state.uiFlags.hasFetched).toEqual(true);
|
|
});
|
|
});
|
|
|
|
describe('#setActiveCampaign', () => {
|
|
it('set active campaign', () => {
|
|
const state = { records: [] };
|
|
mutations.setActiveCampaign(state, campaigns[0]);
|
|
expect(state.activeCampaign).toEqual(campaigns[0]);
|
|
});
|
|
});
|
|
});
|