Chatwoot/app/javascript/dashboard/store/modules/specs/webhooks/mutations.spec.js
Nithin David Thomas c119c6577b
Feature: As a admin, I should be able to add webhooks to account (#572)
Co-authored-by: Pranav Raj S <pranavrajs@gmail.com>
2020-02-29 17:43:49 +05:30

33 lines
945 B
JavaScript

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([]);
});
});
});