diff --git a/src/__test__/components/SurveyPath.test.tsx b/src/__test__/components/SurveyPath.test.tsx
new file mode 100644
index 0000000..6abe143
--- /dev/null
+++ b/src/__test__/components/SurveyPath.test.tsx
@@ -0,0 +1,31 @@
+import { screen, render, waitFor, fireEvent } from "@testing-library/react"
+import { SessionDuration } from "components/SessionDuration"
+import userEvent from "@testing-library/user-event"
+
+describe("", () => {
+ const setup = () => {
+ render()
+ }
+
+ describe("when user fills the survey and fill out the session duration", () => {
+ test("shows a 'Congratulations' message and a link to the student dashboard", async () => {
+ setup()
+ await waitFor(() => {
+ const selectedDate = screen.getByRole('textbox')
+ const selectSessionDuration = screen.getByRole('textbox')
+ const chosenOption = screen.getByText(/30 minutes/i)
+ const submitButton = screen.getByRole('button', { name: /submit/i})
+
+ fireEvent.change(selectedDate, {target: {value: '07\/13\/2022'}})
+ fireEvent.click(selectSessionDuration)
+ fireEvent.click(chosenOption)
+ userEvent.click(submitButton)
+
+ const happyMessage = screen.getByText(/Congratulations/i)
+ const linkStudentDashboard = screen.getByRole('link', { name: /Back to home page/i})
+ expect(happyMessage).toBeInTheDocument()
+ expect(linkStudentDashboard).toBeInTheDocument()
+ })
+ })
+ })
+})
diff --git a/src/components/App.tsx b/src/components/App.tsx
index cd6f963..43cfd0f 100644
--- a/src/components/App.tsx
+++ b/src/components/App.tsx
@@ -18,11 +18,11 @@ if (params.token) {
const queryClient = new QueryClient()
const uriLink = () => {
- // if (window.location.href.indexOf("inkind-volunteer.herokuapp.com") > -1) {
+ if (window.location.href.indexOf("inkind-volunteer.herokuapp.com") > -1) {
return "https://inkind-admining.herokuapp.com/graphql"
- // } else {
- // return "http://localhost:3001/graphql"
- // }
+ } else {
+ return "http://localhost:3001/graphql"
+ }
}
const link = createHttpLink({
diff --git a/src/components/SessionDuration/index.tsx b/src/components/SessionDuration/index.tsx
index cab8ac0..65e2c27 100644
--- a/src/components/SessionDuration/index.tsx
+++ b/src/components/SessionDuration/index.tsx
@@ -78,20 +78,14 @@ export const SessionDuration = (): JSX.Element => {
))}
- { isValid && (
+
- )}
-
- { !isValid && (
-
- )}