#204 Error management (#237)

* added error snackbar for api fails
* improved error page to be shown only for userdata errors and to allow retrying
* fixed test breaking only in local because of timezone and reduced warnings for easier reading of tests results
* added error management for failure inside calendars imports
* added error snackbar for api fails
* improved error page to be shown only for userdata errors and to allow retrying
* added error management for failure inside calendars imports

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
Camille Moussu
2025-10-27 11:23:38 +01:00
committed by GitHub
parent 4774e78543
commit 42f5d8e1a9
17 changed files with 960 additions and 371 deletions
@@ -37,11 +37,6 @@ describe("Calendar - Timezone Integration", () => {
timeZone: "America/New_York",
pending: false,
},
events: {
selectedEvent: null,
isEditMode: false,
editModeDialogOpen: false,
},
};
beforeEach(() => {
@@ -104,6 +104,26 @@ describe("Event Preview Display", () => {
};
it("renders correctly event data", () => {
const originalToLocaleString = Date.prototype.toLocaleString;
jest.spyOn(Date.prototype, "toLocaleString").mockImplementation(function (
this: Date,
locales?: Intl.LocalesArgument,
options?: Intl.DateTimeFormatOptions
) {
return originalToLocaleString.call(this, "en-US", options);
});
const originalToLocaleTimeString = Date.prototype.toLocaleTimeString;
jest
.spyOn(Date.prototype, "toLocaleTimeString")
.mockImplementation(function (
this: Date,
locales?: Intl.LocalesArgument,
options?: Intl.DateTimeFormatOptions
) {
return originalToLocaleTimeString.call(this, "en-US", options);
});
renderWithProviders(
<EventPreviewModal
open={true}
+2 -2
View File
@@ -73,9 +73,9 @@ describe("HandleLogin", () => {
expect(screen.getByAltText("loading")).toBeInTheDocument();
});
test("goes to error page when userData doesnt exists after loading and calendars pending is false", () => {
test("goes to error page when there is error in user data", () => {
const dispatch = appHooks.useAppDispatch();
renderWithProviders(<HandleLogin />, { user: { loading: false } });
renderWithProviders(<HandleLogin />, { user: { error: true } });
expect(dispatch).toHaveBeenCalledWith(push("/error"));
});
});