Skip to content

Commit

Permalink
#23 add tests for extension
Browse files Browse the repository at this point in the history
  • Loading branch information
motorina0 committed Apr 8, 2021
1 parent d3b893b commit 0444dc2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ before_script:
- yarn install
script:
- yarn lint
- yarn build
- yarn build
- yarn run test
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
verbose: true,
transform: {
"^.+\\.(jsx)$": "babel-jest",
"^.+\\.(js|jsx)$": "babel-jest",
},
moduleNameMapper: {
"^.+.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$":
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"lint": "eslint . --ext .js,.jsx --max-warnings 0",
"lint:fix": "eslint . --ext .js,.jsx --fix",
"format": "prettier --loglevel silent --write \"**/*.(js|ts|jsx|tsx)\"",
"test-ext": "jest ./src/extension",
"test-app": "jest ./src/app",
"test": "jest"
},
"husky": {
Expand Down
20 changes: 11 additions & 9 deletions src/app/components/SetPassword/SetPassword.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import renderer from "react-test-renderer";

import SetPassword from "./index";

test("Link changes the class when hovered", () => {
const handlePasswordModalOk = () => {
console.log("handlePasswordModalOk");
};
const component = renderer.create(
<SetPassword visible={false} onOk={handlePasswordModalOk}></SetPassword>
);
describe("SetPassword Component", () => {
test("should have correct title", () => {
const handlePasswordModalOk = () => {
console.log("handlePasswordModalOk");
};
const component = renderer.create(
<SetPassword visible={false} onOk={handlePasswordModalOk}></SetPassword>
);

const tree = component.toTree();
expect(tree.rendered.props.title).toEqual("Your Password");
const tree = component.toTree();
expect(tree.rendered.props.title).toEqual("Your Password");
});
});
10 changes: 10 additions & 0 deletions src/extension/inpage-script/donation.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Donation from "./donation";

describe("Donation", () => {
test("should generate correct hash", () => {
const donation = new Donation("test-location");
expect(donation.getHash()).toEqual(
"ae9235c77e2e0c9853d8204badc33379a175d3e75349438a254778170a19b091"
);
});
});

0 comments on commit 0444dc2

Please sign in to comment.