diff --git a/src/app/[username]/components/ErrorMessages.test.tsx b/src/app/[username]/components/ErrorMessages.test.tsx
new file mode 100644
index 00000000..9f5b1e11
--- /dev/null
+++ b/src/app/[username]/components/ErrorMessages.test.tsx
@@ -0,0 +1,37 @@
+import { render, screen } from '@testing-library/react';
+import { describe, it, expect } from 'vitest';
+import ErrorMessages from './ErrorMessages';
+
+describe('ErrorMessages', () => {
+ it('returns null when errors array is undefined', () => {
+ // @ts-expect-error Testing invalid input for robustness
+ const { container } = render();
+ expect(container.firstChild).toBeNull();
+ });
+
+ it('returns null when errors array is empty', () => {
+ const { container } = render();
+ expect(container.firstChild).toBeNull();
+ });
+
+ it('renders a single error message correctly', () => {
+ const errors = [{ section: 'Test Section', message: 'Test message' }];
+ render();
+
+ expect(screen.getByText('Test Section:')).toBeInTheDocument();
+ expect(screen.getByText('Test message')).toBeInTheDocument();
+ });
+
+ it('renders multiple error messages correctly', () => {
+ const errors = [
+ { section: 'Section 1', message: 'Message 1' },
+ { section: 'Section 2', message: 'Message 2' },
+ ];
+ render();
+
+ expect(screen.getByText('Section 1:')).toBeInTheDocument();
+ expect(screen.getByText('Message 1')).toBeInTheDocument();
+ expect(screen.getByText('Section 2:')).toBeInTheDocument();
+ expect(screen.getByText('Message 2')).toBeInTheDocument();
+ });
+});
diff --git a/vitest.config.ts b/vitest.config.ts
index 85834413..d7f6dd7e 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -23,6 +23,7 @@ export default defineConfig({
"src/components/SkillsCard.tsx",
"src/components/LayoutEditor.tsx",
"src/lib/rateLimit.ts",
+ "src/app/[username]/components/ErrorMessages.tsx",
],
thresholds: {
lines: 80,