-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Code-Hammers/CHE-16/subtask/Create-Alumni…
…-Directory-Page Che 16/subtask/create alumni directory page
- Loading branch information
Showing
4 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
17 changes: 17 additions & 0 deletions
17
client/src/pages/DirectoryPage/__snapshots__/DirectoryPage.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |