Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]Smoke test js #61

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ env/
**/*.pyc
**/__pycache__

# Ignore coverage files
Frontend/coverage

# Logs
logs
*.log
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ templates
README.md
*.yml
*.yaml
CONTRIBUTION.md
CONTRIBUTION.md
Frontend/coverage
Copy link
Member

@shubhank-saxena shubhank-saxena May 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of ignoring the directory that is being formed, we can ignore the following files

  1. coverage
  2. coverage.xml
  3. .coverage

Also is it possible to shift tests in the root directory? Ideally, the path of test files should be -
./tests/frontend/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do add a single end line at the end of the file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of ignoring the directory that is being formed, we can ignore the following files

  1. coverage
  2. coverage.xml
  3. .coverage

Also is it possible to shift tests in the root directory? Ideally, the path of test files should be -
./tests/frontend/

React isn't detecting any test files outside the src/ folder. It's their rule to reside test files in src/ folder. Looking if I find any tweak for this.

1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- yarn install --frozen-lockfile
script:
- yarn format
- yarn test -- --coverage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the -- --coverage?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's to print the coverage result, that tabular output


#This test helps us to check integrity of the backend code
- language: python
Expand Down
3 changes: 3 additions & 0 deletions Frontend/src/setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { configure } from "enzyme";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have this in the frontend tests folder itself instead of one level above?

import Adapter from "enzyme-adapter-react-16";
configure({ adapter: new Adapter() });
11 changes: 11 additions & 0 deletions Frontend/src/tests/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "../App";

import { shallow, mount } from "enzyme";

it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"google-maps-react": "^2.0.6",
"react": "^16.13.1",
"react-app-rewired": "^2.1.5",
Expand All @@ -27,6 +29,7 @@
"react-reveal": "^1.2.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"react-test-renderer": "^16.13.1",
"styled": "^1.0.0",
"styled-components": "^5.1.0"
},
Expand All @@ -53,6 +56,12 @@
]
},
"devDependencies": {
"jest-canvas-mock": "^2.2.0",
"prettier": "2.0.5"
},
"jest": {
"setupFiles": [
"jest-canvas-mock"
]
}
}
Loading