* Fetch previous messages in the conversation * Add specs for conversation store * Fix codeclimate issues * Exclude specs folder * Exclude globally * Fix path in exclude patterns * Add endPoints spec * Add snapshots for Spinner * Add specs for actions
57 lines
1.1 KiB
JavaScript
57 lines
1.1 KiB
JavaScript
import { getters } from '../../conversation';
|
|
|
|
describe('#getters', () => {
|
|
it('getConversation', () => {
|
|
const state = {
|
|
conversations: {
|
|
1: {
|
|
content: 'hello',
|
|
},
|
|
},
|
|
};
|
|
expect(getters.getConversation(state)).toEqual({
|
|
1: {
|
|
content: 'hello',
|
|
},
|
|
});
|
|
});
|
|
|
|
it('getConversationSize', () => {
|
|
const state = {
|
|
conversations: {
|
|
1: {
|
|
content: 'hello',
|
|
},
|
|
},
|
|
};
|
|
expect(getters.getConversationSize(state)).toEqual(1);
|
|
});
|
|
|
|
it('getEarliestMessage', () => {
|
|
const state = {
|
|
conversations: {
|
|
1: {
|
|
content: 'hello',
|
|
},
|
|
2: {
|
|
content: 'hello1',
|
|
},
|
|
},
|
|
};
|
|
expect(getters.getEarliestMessage(state)).toEqual({
|
|
content: 'hello',
|
|
});
|
|
});
|
|
|
|
it('uiFlags', () => {
|
|
const state = {
|
|
uiFlags: {
|
|
allMessagesLoaded: false,
|
|
isFetchingList: false,
|
|
},
|
|
};
|
|
expect(getters.getAllMessagesLoaded(state)).toEqual(false);
|
|
expect(getters.getIsFetchingList(state)).toEqual(false);
|
|
});
|
|
});
|