Chatwoot/app/javascript/dashboard/store/modules/specs/conversationSearch/mutations.spec.js
Pranav Raj S 7718cf7d2c
feat: Add global message search (#1385)
* feat: Search messages by content

* Fix search UI

* Add specs

* chore: Filter search results

* Update highlight logic

* Rename query to searchTerm

Co-authored-by: Sojan <sojan@pepalo.com>
2020-11-08 01:46:45 +05:30

22 lines
713 B
JavaScript

import types from '../../../mutation-types';
import { mutations } from '../../conversationSearch';
describe('#mutations', () => {
describe('#SEARCH_CONVERSATIONS_SET', () => {
it('set records correctly', () => {
const state = { records: [] };
mutations[types.SEARCH_CONVERSATIONS_SET](state, [{ id: 1 }]);
expect(state.records).toEqual([{ id: 1 }]);
});
});
describe('#SEARCH_CONVERSATIONS_SET', () => {
it('set uiFlags correctly', () => {
const state = { uiFlags: { isFetching: true } };
mutations[types.SEARCH_CONVERSATIONS_SET_UI_FLAG](state, {
isFetching: false,
});
expect(state.uiFlags).toEqual({ isFetching: false });
});
});
});