Skip to content

Commit

Permalink
Merge pull request #41 from Arquisoft/web_skeleton
Browse files Browse the repository at this point in the history
Jest tests now pass. yay!
  • Loading branch information
MarcosTobias authored Mar 7, 2021
2 parents d8dcd9a + b3f19c6 commit 189dfc2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion webapp/src/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/Source code/i);
const linkElement = screen.getByText("Home");
expect(linkElement).toBeInTheDocument();
});
2 changes: 0 additions & 2 deletions webapp/src/components/MainCarousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ function SamplePrevArrow(props) {
width: "20px",
height: "20px",
padding: "0",
webkitTransform: "translate(0, -50%)",
msTransform: "translate(0, -50%)",
transform: "translate(0, -50%)",
cursor: "pointer",
Expand All @@ -47,7 +46,6 @@ function SampleNextArrow(props) {
width: "20px",
height: "20px",
padding: "0",
webkitTransform: "translate(0, -50%)",
msTransform: "translate(0, -50%)",
transform: "translate(0, -50%)",
cursor: "pointer",
Expand Down
14 changes: 14 additions & 0 deletions webapp/src/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,17 @@
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
import {jest} from "@jest/globals";

window.matchMedia = jest.fn().mockImplementation((query) => {
return {
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // deprecated
removeListener: jest.fn(), // deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn()
};
});

0 comments on commit 189dfc2

Please sign in to comment.