Due to the pattern `**/specs/*.spec.js` defined in CircleCI, none of the frontend spec in the folders such as `specs/<domain-name>/getters.spec.js` were not executed in Circle CI. This PR fixes the issue, along with the following changes: - Use vitest instead of jest - Remove jest dependancies - Update tests to work with vitest --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import { mutations } from '../../campaign';
|
|
import { campaigns } from './data';
|
|
vi.mock('widget/store/index.js', () => ({
|
|
default: {},
|
|
}));
|
|
|
|
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);
|
|
});
|
|
});
|
|
});
|