From 036e43069d224c592cf038fc59d8ebc7d0cf25c8 Mon Sep 17 00:00:00 2001 From: anfbermudezme Date: Thu, 27 Jun 2024 23:30:11 +0200 Subject: [PATCH] fix: encode url for class details page. --- src/features/Classes/Class/ClassPage/index.jsx | 2 +- src/features/Classes/InstructorCard/index.jsx | 2 +- .../Courses/CourseDetailTable/__test__/columns.test.jsx | 2 +- src/features/Courses/CourseDetailTable/columns.jsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/features/Classes/Class/ClassPage/index.jsx b/src/features/Classes/Class/ClassPage/index.jsx index b33c32eb..6d5c5354 100644 --- a/src/features/Classes/Class/ClassPage/index.jsx +++ b/src/features/Classes/Class/ClassPage/index.jsx @@ -96,7 +96,7 @@ const ClassPage = () => { -

Class details: {classId}

+

Class details: {decodeURIComponent(classId)}

diff --git a/src/features/Classes/InstructorCard/index.jsx b/src/features/Classes/InstructorCard/index.jsx index ed808ba6..5eba96b0 100644 --- a/src/features/Classes/InstructorCard/index.jsx +++ b/src/features/Classes/InstructorCard/index.jsx @@ -45,7 +45,7 @@ const InstructorCard = () => {

- {classId} + {decodeURIComponent(classId)}

{isLoadingClasses && (
diff --git a/src/features/Courses/CourseDetailTable/__test__/columns.test.jsx b/src/features/Courses/CourseDetailTable/__test__/columns.test.jsx index 2d1cbc0a..53d15f1f 100644 --- a/src/features/Courses/CourseDetailTable/__test__/columns.test.jsx +++ b/src/features/Courses/CourseDetailTable/__test__/columns.test.jsx @@ -73,7 +73,7 @@ describe('columns', () => { const linkElement = screen.getByText('Class example'); expect(linkElement).toBeInTheDocument(); expect(linkElement).toHaveClass('text-truncate link'); - expect(linkElement).toHaveAttribute('href', '/courses/Demo Course 1/Class example?classId=class id&previous=courses'); + expect(linkElement).toHaveAttribute('href', '/courses/Demo Course 1/Class example?classId=class%20id&previous=courses'); }); test('Should render the dates', () => { diff --git a/src/features/Courses/CourseDetailTable/columns.jsx b/src/features/Courses/CourseDetailTable/columns.jsx index 7abc52ce..ea46de93 100644 --- a/src/features/Courses/CourseDetailTable/columns.jsx +++ b/src/features/Courses/CourseDetailTable/columns.jsx @@ -22,7 +22,7 @@ const columns = [ const { courseId } = useParams(); return ( {row.values.className}