feat: Update the design for canned responses (#9903)

This is the continuation of the design update series. Canned responses listing page is rewritten with the design change.
---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: iamsivin <iamsivin@gmail.com>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
This commit is contained in:
Pranav
2024-08-07 09:43:47 -07:00
committed by GitHub
parent 646cfb97e7
commit 80a90d9d8c
5 changed files with 251 additions and 215 deletions

View File

@@ -0,0 +1,43 @@
import CannedResponses from '../../cannedResponse';
const CANNED_RESPONSES = [
{ short_code: 'hello', content: 'Hi ' },
{ short_code: 'ask', content: 'Ask questions' },
{ short_code: 'greet', content: 'Good morning' },
];
const getters = CannedResponses.getters;
describe('#getCannedResponses', () => {
it('returns canned responses', () => {
const state = { records: CANNED_RESPONSES };
expect(getters.getCannedResponses(state)).toEqual(CANNED_RESPONSES);
});
});
describe('#getSortedCannedResponses', () => {
it('returns sort canned responses in ascending order', () => {
const state = { records: CANNED_RESPONSES };
expect(getters.getSortedCannedResponses(state)('asc')).toEqual([
CANNED_RESPONSES[1],
CANNED_RESPONSES[2],
CANNED_RESPONSES[0],
]);
});
it('returns sort canned responses in descending order', () => {
const state = { records: CANNED_RESPONSES };
expect(getters.getSortedCannedResponses(state)('desc')).toEqual([
CANNED_RESPONSES[0],
CANNED_RESPONSES[2],
CANNED_RESPONSES[1],
]);
});
});
describe('#getUIFlags', () => {
it('returns uiFlags', () => {
const state = { uiFlags: { isFetching: true } };
expect(getters.getUIFlags(state)).toEqual({ isFetching: true });
});
});