diff --git a/__tests__/components/__snapshots__/error.test.jsx.snap b/__tests__/components/__snapshots__/error.test.jsx.snap
index e804bff57..ff4eb1b04 100644
--- a/__tests__/components/__snapshots__/error.test.jsx.snap
+++ b/__tests__/components/__snapshots__/error.test.jsx.snap
@@ -13,7 +13,7 @@ exports[`ErrorComponet displays error cause and error message properly 1`] = `
/>
{
@@ -15,3 +17,43 @@ describe('Navbar rendering correctly', () => {
expect(tree).toMatchSnapshot();
});
});
+
+describe('Navbar Home button', () => {
+ const findHomeLink = () => screen.getByRole('link', { name: /freecodecamp logo/i });
+
+ it('points to the application home page when logged in as a teacher', () => {
+ render(
+
+
+
+ );
+ expect(findHomeLink()).toHaveAttribute('href', '/');
+ });
+
+ it('points to the application home page when logged in as an admin', () => {
+ render(
+
+
+
+ );
+ expect(findHomeLink()).toHaveAttribute('href', '/');
+ });
+
+ it('points to the application home page when logged in as another role', () => {
+ render(
+
+
+
+ );
+ expect(findHomeLink()).toHaveAttribute('href', '/');
+ });
+
+ it('points to the application home page when not logged in', () => {
+ render(
+
+
+
+ );
+ expect(findHomeLink()).toHaveAttribute('href', '/');
+ });
+});
diff --git a/components/navbar.js b/components/navbar.js
index fc24c5080..1f4c3664b 100644
--- a/components/navbar.js
+++ b/components/navbar.js
@@ -8,7 +8,7 @@ export default function Navbar({ children, hideAuthButton = false }) {