add test coverage
This commit is contained in:
parent
b2ddfec8c6
commit
353e7c8991
21
package.json
21
package.json
@ -29,6 +29,7 @@
|
||||
"build": "rollup -c && yarn build:types",
|
||||
"build:types": "tsc",
|
||||
"test": "react-scripts test",
|
||||
"test:coverage": "yarn test --coverage --watchAll=false ",
|
||||
"eject": "react-scripts eject",
|
||||
"storybook": "start-storybook -p 6006 -s public",
|
||||
"build-storybook": "build-storybook -s public"
|
||||
@ -99,5 +100,23 @@
|
||||
"homepage": "https://github.com/vegaprotocol/ui-toolkit",
|
||||
"keywords": [
|
||||
"vega"
|
||||
]
|
||||
],
|
||||
"jest": {
|
||||
"collectCoverageFrom": [
|
||||
"**/**/*.{ts,tsx}",
|
||||
"!**/**/*.stories.tsx"
|
||||
],
|
||||
"coverageReporters": [
|
||||
"html",
|
||||
"json"
|
||||
],
|
||||
"coverageThreshold": {
|
||||
"global": {
|
||||
"branches": 100,
|
||||
"functions": 100,
|
||||
"lines": 100,
|
||||
"statements": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,3 +41,25 @@ test("It links to ropsten etherscan if network is ropsten", () => {
|
||||
"https://ropsten.etherscan.io/address/address"
|
||||
);
|
||||
});
|
||||
|
||||
test("Doesn't render for address if chainid is null", () => {
|
||||
render(<EtherscanLink chainId={null} address="address" />);
|
||||
expect(screen.queryByTestId("etherscan-link")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("Doesn't render for tx if chainid is null", () => {
|
||||
render(<EtherscanLink chainId={null} tx="tx" />);
|
||||
expect(screen.queryByTestId("etherscan-link")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("Doesn't render for address if chainid is unknown", () => {
|
||||
// @ts-ignore
|
||||
render(<EtherscanLink chainId={"foo"} address="address" />);
|
||||
expect(screen.queryByTestId("etherscan-link")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("Doesn't render for tx if chainid is unknown", () => {
|
||||
// @ts-ignore
|
||||
render(<EtherscanLink chainId={"foo"} tx="tx" />);
|
||||
expect(screen.queryByTestId("etherscan-link")).not.toBeInTheDocument();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user