Skip to content

Commit

Permalink
Merge pull request #38 from Code-Hammers/CHE-16/subtask/Create-Alumni…
Browse files Browse the repository at this point in the history
…-Directory-Page

Che 16/subtask/create alumni directory page
  • Loading branch information
brok3turtl3 authored Jan 13, 2024
2 parents f02945e + e263ab6 commit 0039809
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build-tests.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: build-tests
on:
pull_request:
branches:
- dev
jobs:
unit-testing:
runs-on: ubuntu-latest
Expand Down
31 changes: 31 additions & 0 deletions client/src/pages/DirectoryPage/DirectoryPage.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import { create } from "react-test-renderer";
import { Provider } from "react-redux";
import configureStore from "redux-mock-store";

import DirectoryPage from "./DirectoryPage";

interface State {
user: {
userName: string;
};
}

const mockStore = configureStore<State>([]);
const initialState: State = {
user: {
userName: "TEST",
},
};

describe("MainPage Component", () => {
it("renders correctly", () => {
const store = mockStore(initialState);
const tree = create(
<Provider store={store}>
<DirectoryPage />
</Provider>
).toJSON();
expect(tree).toMatchSnapshot();
});
});
15 changes: 15 additions & 0 deletions client/src/pages/DirectoryPage/DirectoryPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";
import { useAppSelector } from "../../app/hooks";

const DirectoryPage = (): JSX.Element => {
const user = useAppSelector((state) => state.user.userData);

return (
<div className="min-h-screen bg-gray-100 flex flex-col items-center justify-center">
<h1 className="text-4xl font-extrabold mb-4">Directory Page</h1>
<h1>Welcome {user?.firstName} !</h1>
</div>
);
};

export default DirectoryPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`MainPage Component renders correctly 1`] = `
<div
className="min-h-screen bg-gray-100 flex flex-col items-center justify-center"
>
<h1
className="text-4xl font-extrabold mb-4"
>
Directory Page
</h1>
<h1>
Welcome
!
</h1>
</div>
`;

0 comments on commit 0039809

Please sign in to comment.