Skip to content

Commit

Permalink
Test pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Bláha committed Jan 20, 2022
1 parent 05d4ce8 commit 22a7c5a
Show file tree
Hide file tree
Showing 9 changed files with 4,173 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!react-markdown)/\"",
"eject": "react-scripts eject"
},
"eslintConfig": {
Expand Down
35 changes: 35 additions & 0 deletions packages/frontend/src/pages/IssueDetail/IssueDetail.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import renderer from "react-test-renderer"
import { IssueDetail } from "./IssueDetail"
import { testData } from "../../testData"
import { MemoryRouter, Route } from "react-router-dom"

const project = testData.projects[0]
const issue = project.issues[0]

describe("IssueDetail page", () => {
it("should renders correctly", () => {
const tree = renderer.create(
<MemoryRouter
initialEntries={[`/${project.owner}/${project.repo}/${issue.number}`]}
>
<Route
path="/:owner/:project/:issue"
render={(props) => <IssueDetail {...props} data={testData} />}
/>
</MemoryRouter>
)
expect(tree).toMatchSnapshot()
})

it("should renders correctly if there is no related issue", () => {
const tree = renderer.create(
<MemoryRouter initialEntries={[`/${project.owner}/${project.repo}/0`]}>
<Route
path="/:owner/:project/:issue"
render={(props) => <IssueDetail {...props} data={testData} />}
/>
</MemoryRouter>
)
expect(tree).toMatchSnapshot()
})
})
Loading

0 comments on commit 22a7c5a

Please sign in to comment.