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

updated error handling sytem with unified way to show user error messeges #275

Merged
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1f5793a
updated error handling sytem with unified wayt to show user error mes…
nitinawari Dec 26, 2024
b7ec715
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Dec 26, 2024
7b0542d
Merge branch 'OWASP:main' into main
nitinawari Dec 26, 2024
06fd757
Merge branch 'main' into error-handling-with-unified-error-messeging
arkid15r Dec 26, 2024
cb6a97f
Merge branch 'OWASP:main' into main
nitinawari Dec 27, 2024
20f5f8c
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Dec 27, 2024
2cdb74a
absolute import correction
nitinawari Dec 27, 2024
bda5126
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Dec 27, 2024
b658949
Merge branch 'error-handling-with-unified-error-messeging' of https:/…
nitinawari Dec 27, 2024
a175d71
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Dec 29, 2024
4dd40f6
Merge branch 'main' into error-handling-with-unified-error-messeging
arkid15r Dec 31, 2024
b637d98
simplified version of error handling
nitinawari Jan 1, 2025
90975b2
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Jan 1, 2025
96173ae
added new shadcn taost component
nitinawari Jan 2, 2025
ab77d0c
Merge remote-tracking branch 'origin/error-handling-with-unified-erro…
nitinawari Jan 2, 2025
088231c
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Jan 2, 2025
72a6a5b
resolved linting issue
nitinawari Jan 2, 2025
a3e8e3e
Merge remote-tracking branch 'origin/error-handling-with-unified-erro…
nitinawari Jan 2, 2025
58cc7e2
import fix
nitinawari Jan 2, 2025
6d497f2
fix linting
nitinawari Jan 2, 2025
f540b66
updated test cases for app.tsx
nitinawari Jan 2, 2025
ddadb9f
bug fixes
nitinawari Jan 3, 2025
b2b67e5
updated error handling sytem with unified wayt to show user error mes…
nitinawari Dec 26, 2024
f52fa85
absolute import correction
nitinawari Dec 27, 2024
7fe1237
simplified version of error handling
nitinawari Jan 1, 2025
795c623
added new shadcn taost component
nitinawari Jan 2, 2025
574798c
resolved linting issue
nitinawari Jan 2, 2025
6bc771e
import fix
nitinawari Jan 2, 2025
8b25707
fix linting
nitinawari Jan 2, 2025
2713761
updated test cases for app.tsx
nitinawari Jan 2, 2025
10271c7
Merge branch 'OWASP:main' into main
nitinawari Jan 4, 2025
5d3e7e3
bug fixes
nitinawari Jan 4, 2025
4f110f0
error handling bug fixes
nitinawari Jan 4, 2025
6203952
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Jan 4, 2025
48a618c
Merge branch 'main' of https://github.com/nitinawari/Nest into error-…
nitinawari Jan 4, 2025
4a59321
updated ErrorWrapper for error handling
nitinawari Jan 4, 2025
b334c5e
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Jan 4, 2025
a1ca147
updated test cases
nitinawari Jan 4, 2025
9b58c59
Merge remote-tracking branch 'origin/error-handling-with-unified-erro…
nitinawari Jan 4, 2025
4147d4d
Merge branch 'OWASP:main' into main
nitinawari Jan 4, 2025
4271f6c
Merge branch 'OWASP:main' into main
nitinawari Jan 5, 2025
6e67920
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Jan 5, 2025
b013ebf
Merge branch 'main' of https://github.com/nitinawari/Nest into error-…
nitinawari Jan 5, 2025
769030a
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Jan 6, 2025
57fa0ed
bug fixes
nitinawari Jan 6, 2025
8881414
Merge remote-tracking branch 'origin/error-handling-with-unified-erro…
nitinawari Jan 6, 2025
320e4ba
Fix: Rename files
nitinawari Jan 6, 2025
744f35a
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Jan 8, 2025
556c005
resolve confict
nitinawari Jan 8, 2025
09fd8e8
shadcn aliases update
nitinawari Jan 8, 2025
fe5b1ee
Merge branch 'main' into error-handling-with-unified-error-messeging
nitinawari Jan 8, 2025
b55a2da
resolve conflict
nitinawari Jan 8, 2025
137b3f1
Merge branch 'main' into pr/nitinawari/275
arkid15r Jan 9, 2025
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
2 changes: 1 addition & 1 deletion frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ shell-frontend:
@CMD="/bin/bash" $(MAKE) exec-frontend-command-it

test-frontend:
@docker build -f frontend/Dockerfile.test frontend -t nest-frontend-test 2>/dev/null
@docker build -f frontend/Dockerfile.test frontend -t nest-frontend-test
@docker run nest-frontend-test npm run test
37 changes: 37 additions & 0 deletions frontend/__tests__/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/react'
import App from 'App'
import { MemoryRouter } from 'react-router-dom'
import '@testing-library/jest-dom'
import { useToast } from 'lib/hooks/useToast'
import { Toaster } from 'components/ui/Toaster'

jest.mock('pages', () => ({
Home: () => <div data-testid="home-page">Home Page</div>,
Expand All @@ -13,6 +15,13 @@ jest.mock('pages', () => ({
CommitteeDetailsPage: () => <div data-testid="contribute-page">CommitteeDetails Page</div>,
ProjectDetailsPage: () => <div data-testid="contribute-page">ProjectDetails Page</div>,
}))
jest.mock('lib/hooks/useToast', () => ({
useToast: jest.fn(() => ({
toasts: [],
toast: jest.fn(),
dismiss: jest.fn(),
})),
}))

jest.mock('components/Header', () => {
const { Link } = require('react-router-dom')
Expand Down Expand Up @@ -44,6 +53,11 @@ jest.mock('components/Footer', () => {
describe('App Component', () => {
beforeEach(() => {
window.scrollTo = jest.fn()
;(useToast as jest.Mock).mockImplementation(() => ({
toasts: [],
toast: jest.fn(),
dismiss: jest.fn(),
}))
})

afterEach(() => {
Expand Down Expand Up @@ -142,3 +156,26 @@ describe('App Component', () => {
})
})
})
describe('Toaster Component', () => {
beforeEach(() => {
jest.clearAllMocks()
})

it('renders toast with title and description', () => {
const mockToast = {
id: '1',
title: 'Test Title',
description: 'Test Description',
open: true,
}

;(useToast as jest.Mock).mockReturnValue({
toasts: [mockToast],
})

render(<Toaster />)

expect(screen.getByText('Test Title')).toBeInTheDocument()
expect(screen.getByText('Test Description')).toBeInTheDocument()
})
})
21 changes: 21 additions & 0 deletions frontend/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/index.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
Loading
Loading