From ec592b7f5e68f9a002de5a1e447382d385c537aa Mon Sep 17 00:00:00 2001 From: FadyGergesRezk <84906847+FadyGergesRezk@users.noreply.github.com> Date: Fri, 12 Jun 2026 21:16:08 +0200 Subject: [PATCH 1/5] feat: add global error boundary and 404 page --- .../src/__tests__/ErrorBoundary.test.tsx | 127 ++++++++++++++++++ .../src/__tests__/NotFoundPage.test.tsx | 61 +++++++++ web-client/src/app/ErrorBoundary.tsx | 61 +++++++++ web-client/src/app/pages/NotFoundPage.tsx | 23 ++++ web-client/src/app/router/routes.tsx | 2 + web-client/src/main.tsx | 13 +- 6 files changed, 282 insertions(+), 5 deletions(-) create mode 100644 web-client/src/__tests__/ErrorBoundary.test.tsx create mode 100644 web-client/src/__tests__/NotFoundPage.test.tsx create mode 100644 web-client/src/app/ErrorBoundary.tsx create mode 100644 web-client/src/app/pages/NotFoundPage.tsx diff --git a/web-client/src/__tests__/ErrorBoundary.test.tsx b/web-client/src/__tests__/ErrorBoundary.test.tsx new file mode 100644 index 0000000..8cdd63f --- /dev/null +++ b/web-client/src/__tests__/ErrorBoundary.test.tsx @@ -0,0 +1,127 @@ +import { Component, useState, type ReactNode, act } from 'react' +import { createRoot, type Root } from 'react-dom/client' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { GlobalErrorBoundary } from '@/app/ErrorBoundary' + +type ThrowingChildProps = { + shouldThrow: boolean +} + +function ThrowingChild({ shouldThrow }: ThrowingChildProps) { + if (shouldThrow) { + throw new Error('Boom') + } + + return
+ The page you're looking for doesn't exist. +
++
The page you're looking for doesn't exist.