Chatwoot/app/javascript/dashboard/store/modules/specs/webhooks/mutations.spec.js

34 lines
945 B
JavaScript
Raw Normal View History

import * as types from '../../../mutation-types';
import { mutations } from '../../webhooks';
import webhooks from './fixtures';
describe('#mutations', () => {
describe('#SET_WEBHOOK', () => {
it('set webhook records', () => {
const state = { records: [] };
mutations[types.default.SET_WEBHOOK](state, webhooks);
expect(state.records).toEqual(webhooks);
});
});
describe('#ADD_WEBHOOK', () => {
it('push newly created webhook data to the store', () => {
const state = {
records: [],
};
mutations[types.default.ADD_WEBHOOK](state, webhooks[0]);
expect(state.records).toEqual([webhooks[0]]);
});
});
describe('#DELETE_WEBHOOK', () => {
it('delete webhook record', () => {
const state = {
records: [webhooks[0]],
};
mutations[types.default.DELETE_WEBHOOK](state, webhooks[0].id);
expect(state.records).toEqual([]);
});
});
});