-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test for job application dialog (#9)
- Loading branch information
1 parent
71e8002
commit edced46
Showing
2 changed files
with
55 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
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,54 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import JobApplicationDialog from '../JobApplicationDialog'; | ||
import { MockedProvider } from "@apollo/client/testing"; | ||
import dayjs from 'dayjs'; | ||
|
||
|
||
const mocks = []; | ||
|
||
it('Should render New Job Application Dialog', async() => { | ||
render(<MockedProvider mocks={mocks} addTypename={false}> | ||
<JobApplicationDialog | ||
jobApplication={{"status": "open"}} | ||
open={true} | ||
setOpen={false} | ||
isNew={true} /> | ||
</MockedProvider> | ||
); | ||
|
||
expect(screen.getByText("Add Job Application")).toBeInTheDocument(); | ||
expect(screen.getByDisplayValue("open")).toBeInTheDocument(); | ||
const currentDate = dayjs(new Date()).format('MM/DD/YYYY') | ||
expect(screen.getByDisplayValue(currentDate)).toBeInTheDocument(); | ||
expect(screen.getByText("Company Name")).toBeInTheDocument(); | ||
expect(screen.getByText("Job Title")).toBeInTheDocument(); | ||
expect(screen.getByText("Salary Range")).toBeInTheDocument(); | ||
expect(screen.getByText("Description")).toBeInTheDocument(); | ||
expect(screen.getByText("Job Link")).toBeInTheDocument(); | ||
|
||
}); | ||
|
||
it('Should render Edit Job Application Dialog', async() => { | ||
render(<MockedProvider mocks={mocks} addTypename={false}> | ||
<JobApplicationDialog | ||
jobApplication={{"companyName": "a", | ||
"jobTitle": "b", | ||
"salaryRange": "c", | ||
"description": "d", | ||
"jobUrl": "http://example.com", | ||
"appliedDate": '2021-01-01', | ||
"status": "active"}} | ||
open={true} | ||
setOpen={false} | ||
isNew={false} /> | ||
</MockedProvider> | ||
); | ||
expect(screen.getByText("Edit Job Application")).toBeInTheDocument(); | ||
expect(screen.getByDisplayValue("a")).toHaveAttribute('id', 'companyName'); | ||
expect(screen.getByDisplayValue("b")).toHaveAttribute('id', 'jobTitle'); | ||
expect(screen.getByDisplayValue("c")).toHaveAttribute('id', 'salaryRange'); | ||
expect(screen.getByDisplayValue("d")).toHaveAttribute('id', 'description'); | ||
expect(screen.getByDisplayValue("http://example.com")).toHaveAttribute('id', 'jobUrl'); | ||
expect(screen.getByDisplayValue('01/01/2021')).toBeInTheDocument(); | ||
expect(screen.getByDisplayValue("active")).toBeInTheDocument(); | ||
}); |