feat: Add draft messages store (#7476)

This commit is contained in:
Muhsin Keloth
2023-07-11 18:29:42 +05:30
committed by GitHub
parent 09f46aa912
commit 941e7e06cf
8 changed files with 161 additions and 34 deletions

View File

@@ -0,0 +1,33 @@
import types from '../../../mutation-types';
import { mutations } from '../../draftMessages';
describe('#mutations', () => {
describe('#SET_DRAFT_MESSAGES', () => {
it('sets the draft messages', () => {
const state = {
records: {},
};
mutations[types.SET_DRAFT_MESSAGES](state, {
key: 'draft-32-REPLY',
message: 'Hey how ',
});
expect(state.records).toEqual({
'draft-32-REPLY': 'Hey how ',
});
});
});
describe('#REMOVE_DRAFT_MESSAGES', () => {
it('removes the draft messages', () => {
const state = {
records: {
'draft-32-REPLY': 'Hey how ',
},
};
mutations[types.REMOVE_DRAFT_MESSAGES](state, {
key: 'draft-32-REPLY',
});
expect(state.records).toEqual({});
});
});
});