Verified Commit 5007b5f6 authored by reprograma's avatar reprograma
Browse files

set up tests

parent e5fadf3f
......@@ -17,6 +17,8 @@
"chart.js": "^2.9.3",
"chartist": "^0.11.4",
"classnames": "^2.2.6",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.10.0",
......@@ -55,6 +57,15 @@
"lint-staged": "^10.0.7",
"redux-devtools-extension": "^2.13.8"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}",
"!src/index.{js,jsx}"
],
"coverageReporters": [
"text"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
......@@ -65,4 +76,4 @@
"eslint --fix"
]
}
}
}
\ No newline at end of file
import React from "react";
import PropTypes from "prop-types";
import cx from "classnames";
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
// @material-ui/core components
import withStyles from "@material-ui/core/styles/withStyles";
import Button from "@material-ui/core/Button";
import withStyles from '@material-ui/core/styles/withStyles';
import Button from '@material-ui/core/Button';
import paginationStyle from "assets/jss/material-dashboard-pro-react/components/paginationStyle.jsx";
import paginationStyle from 'assets/jss/material-dashboard-pro-react/components/paginationStyle';
function Pagination({ ...props }) {
const { classes, pages, color } = props;
return (
<ul className={classes.pagination}>
{pages.map((prop, key) => {
{pages.map(prop => {
const paginationLink = cx({
[classes.paginationLink]: true,
[classes[color]]: prop.active,
[classes.disabled]: prop.disabled
});
return (
<li className={classes.paginationItem} key={key}>
<li className={classes.paginationItem} key={prop.id}>
{prop.onClick !== undefined ? (
<Button onClick={prop.onClick} className={paginationLink}>
{prop.text}
</Button>
) : (
<Button
onClick={() => console.log("you've clicked " + prop.text)}
// eslint-disable-next-line
onClick={() => console.log('you clicked ' + prop.text)}
className={paginationLink}
>
{prop.text}
......@@ -40,23 +41,24 @@ function Pagination({ ...props }) {
}
Pagination.defaultProps = {
color: "primary"
color: 'primary'
};
Pagination.propTypes = {
classes: PropTypes.object.isRequired,
pages: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string,
active: PropTypes.bool,
disabled: PropTypes.bool,
text: PropTypes.oneOfType([
PropTypes.number,
PropTypes.oneOf(["PREV", "NEXT", "..."])
PropTypes.oneOf(['PREV', 'NEXT', '...'])
]).isRequired,
onClick: PropTypes.func
})
).isRequired,
color: PropTypes.oneOf(["primary", "info", "success", "warning", "danger"])
color: PropTypes.oneOf(['primary', 'info', 'success', 'warning', 'danger'])
};
export default withStyles(paginationStyle)(Pagination);
This diff is collapsed.
import React, { Component } from 'react'
import WalletBalance from "components/widgets/WalletBalance";
import Transactions from 'components/widgets/Transactions'
import WalletActions from 'components/widgets/WalletActions'
import React from 'react';
import WalletBalance from 'components/widgets/WalletBalance';
import Transactions from 'components/widgets/Transactions';
import WalletActions from 'components/widgets/WalletActions';
export default class Wallet extends Component {
render() {
return (
<div>
<WalletBalance />
<WalletActions />
<Transactions />
</div>
)
}
}
const Wallet = () => (
<div>
<WalletBalance />
<WalletActions />
<Transactions />
</div>
);
export default Wallet;
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
const localStorageMock = {
getItem: jest.fn(),
setItem: jest.fn(),
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment