-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3441b4
commit bd88011
Showing
8 changed files
with
108 additions
and
22 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 |
---|---|---|
|
@@ -9,4 +9,5 @@ module.exports = { | |
transform: { | ||
'^.+\\.jsx?$': 'babel-jest', | ||
}, | ||
setupFilesAfterEnv: ['./jest.setup.cjs'], | ||
}; |
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,13 @@ | ||
// Jest isn't compatible with more recent versions of react-markdown, and so this warning arises about future incompatibility. Suppress it, for now. | ||
beforeAll(() => { | ||
jest.spyOn(console, 'error').mockImplementation((msg) => { | ||
if (msg.includes('Support for defaultProps will be removed from function components')) { | ||
return; | ||
} | ||
console.error(msg); | ||
}); | ||
}); | ||
|
||
afterAll(() => { | ||
console.error.mockRestore(); | ||
}); |
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,25 @@ | ||
import "@testing-library/jest-dom"; | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { MemoryRouter } from "react-router-dom"; | ||
import Article from "./Article.jsx"; | ||
|
||
test("Back Button Renders", () => { | ||
render( | ||
<MemoryRouter> | ||
<Article /> | ||
</MemoryRouter> | ||
); | ||
const backButton = screen.getByTestId("back-button"); | ||
expect(backButton).toBeInTheDocument(); | ||
}); | ||
|
||
test("Edit Button Renders", () => { | ||
render( | ||
<MemoryRouter> | ||
<Article /> | ||
</MemoryRouter> | ||
); | ||
const editButton = screen.getByTestId("edit-button"); | ||
expect(editButton).toBeInTheDocument(); | ||
}); |
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
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