chore: Add the specs for sort conversation (#7047)

This commit is contained in:
Muhsin Keloth
2023-05-10 17:49:17 +05:30
committed by GitHub
parent 65bad90b69
commit 55e5fa2205
3 changed files with 147 additions and 13 deletions

View File

@@ -39,6 +39,19 @@ describe('#mutations', () => {
describe('#ASSIGN_TEAM', () => {
it('clears current chat window', () => {
const state = { allConversations: [{ id: 1, meta: {} }] };
mutations[types.UPDATE_CONVERSATION_LAST_ACTIVITY](state, {
lastActivityAt: 1602256198,
conversationId: 1,
});
expect(state.allConversations).toEqual([
{ id: 1, meta: {}, last_activity_at: 1602256198 },
]);
});
});
describe('#UPDATE_CONVERSATION_LAST_ACTIVITY', () => {
it('update conversation last activity', () => {
const state = { allConversations: [{ id: 1, meta: {} }] };
mutations[types.ASSIGN_TEAM](state, {
team: { id: 1, name: 'Team 1' },
@@ -50,6 +63,16 @@ describe('#mutations', () => {
});
});
describe('#CHANGE_CHAT_SORT_FILTER', () => {
it('update conversation sort filter', () => {
const state = { chatSortFilter: 'latest' };
mutations[types.CHANGE_CHAT_SORT_FILTER](state, {
data: 'sort_on_created_at',
});
expect(state.chatSortFilter).toEqual({ data: 'sort_on_created_at' });
});
});
describe('#SET_CURRENT_CHAT_WINDOW', () => {
it('set current chat window', () => {
const state = { selectedChatId: 1 };