Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updated addBoard, addBoardView and SoapFault apis to latest shell BC #241

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
/coverage
/.vscode
zextras-carbonio-*.tgz
.DS_Store
.DS_Store
.tool-versions
28,783 changes: 7,345 additions & 21,438 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@
"jest-fetch-mock": "^3.0.3",
"jest-junit": "^16.0.0",
"jest-styled-components": "^7.2.0",
"msw": "^2.2.7",
"typescript": "^4.9.0"
"msw": "2.2.7",
"typescript": "^4.9.0",
"ts-node": "^10.9.1"
},
"dependencies": {
"@emotion/react": "^11.11.4",
Expand All @@ -68,7 +69,7 @@
"@mui/material": "^5.15.13",
"@reduxjs/toolkit": "^1.9.7",
"@zextras/carbonio-design-system": "^5.0.0",
"@zextras/carbonio-shell-ui": "^7.0.1",
"@zextras/carbonio-shell-ui": "7.0.1-devel.1719821805398",
"axios": "^1.6.8",
"core-js": "^3.36.0",
"i18next": "^22.5.1",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/edit-cg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const useActionEditCG = (): EditActionCG => {
} else {
addBoard({
id: `${EDIT_CONTACT_GROUP_BOARD_ID}-${contactGroup.id}`,
url: EDIT_CONTACT_GROUP_BOARD_ID,
boardViewId: EDIT_CONTACT_GROUP_BOARD_ID,
title: contactGroup.title,
context: { contactGroupId: contactGroup.id }
});
Expand Down
6 changes: 3 additions & 3 deletions src/actions/edit-dl.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('useActionEditDL', () => {
icon: 'DistributionListOutline',
context: { id: dl.id },
id: `${EDIT_DL_BOARD_ID}-${dl.id}`,
url: expect.anything()
boardViewId: expect.anything()
});
});

Expand All @@ -58,7 +58,7 @@ describe('useActionEditDL', () => {
icon: 'DistributionListOutline',
context: { id: dl.id },
id: `${EDIT_DL_BOARD_ID}-${dl.id}`,
url: expect.anything()
boardViewId: expect.anything()
});
});

Expand All @@ -68,7 +68,7 @@ describe('useActionEditDL', () => {
const boardId = `${EDIT_DL_BOARD_ID}-${dl.id}`;
jest.spyOn(shell, 'getBoardById').mockReturnValue({
id: boardId,
url: EDIT_DL_BOARD_ID,
boardViewId: EDIT_DL_BOARD_ID,
app: '',
icon: '',
title: ''
Expand Down
2 changes: 1 addition & 1 deletion src/actions/edit-dl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const useActionEditDL = (): EditDLAction => {
icon: 'DistributionListOutline',
title: distributionList.displayName || distributionList.email,
id: boardId,
url: EDIT_DL_BOARD_ID
boardViewId: EDIT_DL_BOARD_ID
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/actions/export-address-book.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ describe('useActionExportAddressBook', () => {
it('should display an error snackbar if the API returns an error', async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
6 changes: 4 additions & 2 deletions src/actions/move-address-book.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ describe('useActionMoveAddressBook', () => {

const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down Expand Up @@ -491,7 +492,8 @@ describe('useActionMoveAddressBook', () => {

const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/actions/move-contact.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ describe('useActionMoveContact', () => {

const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/actions/move-contacts.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ describe('useActionMoveContacts', () => {

const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/actions/remove-address-book-link.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ describe('useActionRemoveAddressBookLink', () => {

const apiResponse: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
6 changes: 4 additions & 2 deletions src/actions/trash-contacts.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ describe('apiClientactions', () => {
it('should show an error snackbar after receiving a failure result from the API', async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down Expand Up @@ -124,7 +125,8 @@ describe('apiClientactions', () => {
it('should show an error snackbar after receiving a failure result from the restore API', async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
6 changes: 2 additions & 4 deletions src/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as shell from '@zextras/carbonio-shell-ui';

import App from './app';
import { setupTest } from './carbonio-ui-commons/test/test-setup';
import { CONTACT_BOARD_ID } from './constants';
import { ContactInputProps } from './legacy/integrations/contact-input';
import { ContactInputIntegrationWrapper } from './legacy/integrations/contact-input-integration-wrapper';

Expand Down Expand Up @@ -80,7 +81,7 @@ describe('App', () => {
const addBoardView = jest.spyOn(shell, 'addBoardView');
setupTest(<App />);
expect(addBoardView).toHaveBeenCalledWith<Parameters<typeof shell.addBoardView>>({
route: 'contacts',
id: CONTACT_BOARD_ID,
component: expect.anything()
});
});
Expand All @@ -90,7 +91,6 @@ describe('App', () => {
setupTest(<App />);
expect(addBoardView).toHaveBeenCalledWith<Parameters<typeof shell.addBoardView>>({
id: 'new-contact-group-board',
route: 'new-contact-group-board',
component: expect.anything()
});
});
Expand All @@ -100,7 +100,6 @@ describe('App', () => {
setupTest(<App />);
expect(addBoardView).toHaveBeenCalledWith<Parameters<typeof shell.addBoardView>>({
id: 'edit-contact-group-board',
route: 'edit-contact-group-board',
component: expect.anything()
});
});
Expand All @@ -110,7 +109,6 @@ describe('App', () => {
setupTest(<App />);
expect(addBoardView).toHaveBeenCalledWith<Parameters<typeof shell.addBoardView>>({
id: 'edit-dl-board',
route: 'edit-dl-board',
component: expect.anything()
});
});
Expand Down
12 changes: 5 additions & 7 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import {
NEW_CONTACT_GROUP_BOARD_ID,
GROUPS_ROUTE,
EDIT_CONTACT_GROUP_BOARD_ID,
EDIT_DL_BOARD_ID
EDIT_DL_BOARD_ID,
CONTACT_BOARD_ID
} from './constants';
import { useNavigation } from './hooks/useNavigation';
import { ContactInputIntegrationWrapper } from './legacy/integrations/contact-input-integration-wrapper';
Expand Down Expand Up @@ -200,22 +201,19 @@ const App = (): React.JSX.Element => {
component: SearchView
});
addBoardView({
route: CONTACTS_ROUTE,
id: CONTACT_BOARD_ID,
component: BoardView
});
addBoardView({
id: NEW_CONTACT_GROUP_BOARD_ID,
route: NEW_CONTACT_GROUP_BOARD_ID,
component: NewContactGroupBoardView
});
addBoardView({
id: EDIT_CONTACT_GROUP_BOARD_ID,
route: EDIT_CONTACT_GROUP_BOARD_ID,
component: EditContactGroupBoardView
});
addBoardView({
id: EDIT_DL_BOARD_ID,
route: EDIT_DL_BOARD_ID,
component: EditDLBoardView
});
}, [t]);
Expand All @@ -235,7 +233,7 @@ const App = (): React.JSX.Element => {
onClick: (ev): void => {
ev?.preventDefault?.();
addBoard({
url: `${CONTACTS_ROUTE}/new`,
boardViewId: CONTACT_BOARD_ID,
title: t('label.new_contact', 'New Contact')
});
},
Expand All @@ -255,7 +253,7 @@ const App = (): React.JSX.Element => {
icon: 'PeopleOutline',
onClick: (): void => {
addBoard({
url: NEW_CONTACT_GROUP_BOARD_ID,
boardViewId: NEW_CONTACT_GROUP_BOARD_ID,
title: t('board.newContactGroup.title', 'New Group'),
context: { navigateTo }
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/dl-displayer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('Distribution List displayer', () => {
await user.click(await screen.findByRole('button', { name: 'Edit' }));
expect(addBoardFn).toHaveBeenCalledWith(
expect.objectContaining<Partial<Parameters<typeof shell.addBoard>[0]>>({
url: EDIT_DL_BOARD_ID,
boardViewId: EDIT_DL_BOARD_ID,
id: `${EDIT_DL_BOARD_ID}-${dl.id}`,
context: { id: dl.id }
})
Expand Down
4 changes: 2 additions & 2 deletions src/components/dl-list-item.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('DL list item', () => {
);
expect(addBoardFn).toHaveBeenCalledWith(
expect.objectContaining<Partial<Parameters<typeof shell.addBoard>[0]>>({
url: EDIT_DL_BOARD_ID,
boardViewId: EDIT_DL_BOARD_ID,
context: { id: dl.id }
})
);
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('DL list item', () => {
await user.click(await screen.findByText('Edit'));
expect(addBoardFn).toHaveBeenCalledWith(
expect.objectContaining<Partial<Parameters<typeof shell.addBoard>[0]>>({
url: EDIT_DL_BOARD_ID,
boardViewId: EDIT_DL_BOARD_ID,
context: { id: dl.id }
})
);
Expand Down
6 changes: 4 additions & 2 deletions src/components/modals/address-book-create.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ describe('AddressBookCreateModal', () => {
const addressBookName = faker.word.noun(3);
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand All @@ -288,7 +289,8 @@ describe('AddressBookCreateModal', () => {
const addressBookName = faker.word.noun(3);
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ describe('AddressBookDeleteModal', () => {
it('should show an error snackbar after receiving a failure result from the API', async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand All @@ -140,7 +141,8 @@ describe('AddressBookDeleteModal', () => {
it("shouldn't close the modal after a failure result from the API", async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ describe('AddressBookEmptyModal', () => {
it('should show an error snackbar after receiving a failure result from the API', async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand All @@ -177,7 +178,8 @@ describe('AddressBookEmptyModal', () => {
it("shouldn't close the modal after a failure result from the API", async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ describe('AddressBookTrashModal', () => {
it('should show an error snackbar after receiving a failure result from the API', async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand All @@ -140,7 +141,8 @@ describe('AddressBookTrashModal', () => {
it("shouldn't close the modal after a failure result from the API", async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down Expand Up @@ -185,7 +187,8 @@ describe('AddressBookTrashModal', () => {
it('should show an error snackbar after receiving a failure result from the restore API', async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
6 changes: 4 additions & 2 deletions src/components/modals/contacts-delete.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ describe('ContactsDeleteModal', () => {
it('should show an error snackbar after receiving a failure result from the API', async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand All @@ -127,7 +128,8 @@ describe('ContactsDeleteModal', () => {
it("shouldn't close the modal after a failure result from the API", async () => {
const response: ErrorSoapBodyResponse = {
Fault: {
Detail: { Error: { Code: faker.string.uuid(), Detail: faker.word.preposition() } },
Code: { Value: faker.string.uuid() },
Detail: { Error: { Code: faker.string.uuid(), Trace: faker.word.preposition() } },
Reason: { Text: faker.word.sample() }
}
};
Expand Down
Loading