Chatwoot/app/javascript/dashboard/store/modules/specs/campaigns/mutations.spec.js
2021-05-04 15:08:41 +05:30

21 lines
679 B
JavaScript

import types from '../../../mutation-types';
import { mutations } from '../../campaigns';
import campaigns from './fixtures';
describe('#mutations', () => {
describe('#SET_CAMPAIGNS', () => {
it('set campaigns records', () => {
const state = { records: [] };
mutations[types.SET_CAMPAIGNS](state, campaigns);
expect(state.records).toEqual(campaigns);
});
});
describe('#ADD_CAMPAIGN', () => {
it('push newly created campaigns to the store', () => {
const state = { records: [campaigns[0]] };
mutations[types.ADD_CAMPAIGN](state, campaigns[1]);
expect(state.records).toEqual([campaigns[0], campaigns[1]]);
});
});
});