feat: Add store for conversation watchers (#5808)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Nithin David Thomas
2022-11-08 09:33:14 -08:00
committed by GitHub
parent 6ff0c93659
commit 0d9ed0674b
8 changed files with 240 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import types from '../../../mutation-types';
import { mutations } from '../../conversationWatchers';
describe('#mutations', () => {
describe('#SET_CONVERSATION_WATCHERS', () => {
it('sets an individual record', () => {
let state = {
records: {},
};
mutations[types.SET_CONVERSATION_WATCHERS](state, {
data: [],
conversationId: 1,
});
expect(state.records).toEqual({ 1: [] });
});
});
describe('#SET_CONVERSATION_WATCHERS_UI_FLAG', () => {
it('set ui flags', () => {
let state = {
uiFlags: {
isFetching: true,
isUpdating: false,
},
};
mutations[types.SET_CONVERSATION_WATCHERS_UI_FLAG](state, {
isFetching: false,
});
expect(state.uiFlags).toEqual({
isFetching: false,
isUpdating: false,
});
});
});
});