feat: Add draft messages store (#7476)
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import axios from 'axios';
|
||||
import { actions } from '../../draftMessages';
|
||||
import types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#set', () => {
|
||||
it('sends correct actions', async () => {
|
||||
await actions.set(
|
||||
{
|
||||
commit,
|
||||
state: {
|
||||
draftMessages: {},
|
||||
},
|
||||
},
|
||||
{ key: 'draft-32-REPLY', message: 'Hey how ' }
|
||||
);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[
|
||||
types.SET_DRAFT_MESSAGES,
|
||||
{
|
||||
key: 'draft-32-REPLY',
|
||||
message: 'Hey how ',
|
||||
},
|
||||
],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#delete', () => {
|
||||
it('sends correct actions', async () => {
|
||||
await actions.delete(
|
||||
{
|
||||
commit,
|
||||
state: {
|
||||
draftMessages: {},
|
||||
},
|
||||
},
|
||||
{ key: 'draft-32-REPLY' }
|
||||
);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[
|
||||
types.SET_DRAFT_MESSAGES,
|
||||
{
|
||||
key: 'draft-32-REPLY',
|
||||
},
|
||||
],
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user