feat: Save UI state in the database (#1635)

feat: Save UI state in the database
This commit is contained in:
Pranav Raj S
2021-01-10 19:25:33 +05:30
committed by GitHub
parent 37d8e1c9a0
commit 160a6fc6cf
13 changed files with 129 additions and 15 deletions

View File

@@ -70,6 +70,32 @@ describe('#actions', () => {
});
});
describe('#updateUISettings', () => {
it('sends correct actions if API is success', async () => {
axios.put.mockResolvedValue({
data: {
id: 1,
name: 'John',
availability_status: 'offline',
ui_settings: { is_contact_sidebar_open: true },
},
headers: { expiry: 581842904 },
});
await actions.updateUISettings(
{ commit, dispatch },
{ uiSettings: { is_contact_sidebar_open: false } }
);
expect(setUser).toHaveBeenCalledTimes(1);
expect(commit.mock.calls).toEqual([
[
types.default.SET_CURRENT_USER_UI_SETTINGS,
{ uiSettings: { is_contact_sidebar_open: false } },
],
[types.default.SET_CURRENT_USER],
]);
});
});
describe('#setUser', () => {
it('sends correct actions if user is logged in', async () => {
Cookies.getJSON.mockImplementation(() => true);