Fix snapshot testing
This commit is contained in:
parent
94c0833766
commit
cb16d68060
11 changed files with 346 additions and 366 deletions
34
.babelrc
34
.babelrc
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"corejs": "3.2.1",
|
||||
"modules": false,
|
||||
"useBuiltIns": "usage"
|
||||
}
|
||||
],
|
||||
"@babel/preset-react",
|
||||
"@babel/preset-typescript"
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
[
|
||||
"@babel/plugin-proposal-decorators",
|
||||
{
|
||||
"decoratorsBeforeExport": true
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
"react-intl-auto",
|
||||
[
|
||||
"react-intl",
|
||||
{
|
||||
"extractFromFormatMessageCall": true,
|
||||
"messagesDir": "build/locale/"
|
||||
}
|
||||
]
|
||||
],
|
||||
"ignore": ["**/*.test.ts", "**/*.test.tsx", "src/storybook"]
|
||||
}
|
42
babel.config.js
Normal file
42
babel.config.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
module.exports = api => {
|
||||
const isTest = api.env("test");
|
||||
|
||||
const ignore = isTest
|
||||
? []
|
||||
: ["**/*.test.ts", "**/*.test.tsx", "src/storybook"];
|
||||
|
||||
return {
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
corejs: "3.2.1",
|
||||
modules: isTest ? "auto" : false,
|
||||
useBuiltIns: "usage"
|
||||
}
|
||||
],
|
||||
"@babel/preset-react",
|
||||
"@babel/preset-typescript"
|
||||
],
|
||||
plugins: [
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
[
|
||||
"@babel/plugin-proposal-decorators",
|
||||
{
|
||||
decoratorsBeforeExport: true
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
"react-intl-auto",
|
||||
[
|
||||
"react-intl",
|
||||
{
|
||||
extractFromFormatMessageCall: true,
|
||||
messagesDir: "build/locale/"
|
||||
}
|
||||
]
|
||||
],
|
||||
ignore
|
||||
};
|
||||
};
|
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -19629,19 +19629,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"ts-loader": {
|
||||
"version": "5.4.5",
|
||||
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-5.4.5.tgz",
|
||||
"integrity": "sha512-XYsjfnRQCBum9AMRZpk2rTYSVpdZBpZK+kDh0TeT3kxmQNBDVIeUjdPjY5RZry4eIAb8XHc4gYSUiUWPYvzSRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.3.0",
|
||||
"enhanced-resolve": "^4.0.0",
|
||||
"loader-utils": "^1.0.2",
|
||||
"micromatch": "^3.1.4",
|
||||
"semver": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"ts-node": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.3.0.tgz",
|
||||
|
|
|
@ -139,13 +139,8 @@
|
|||
"fsevents": "^1.2.9"
|
||||
},
|
||||
"jest": {
|
||||
"globals": {
|
||||
"ts-jest": {
|
||||
"tsConfig": "tsconfig.json"
|
||||
}
|
||||
},
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "ts-jest",
|
||||
"^.+\\.(jsx?|tsx?)$": "babel-jest",
|
||||
"^.+\\.(png|svg|jpe?g)$": "jest-file"
|
||||
},
|
||||
"testRegex": ".*\\.test\\.tsx?$",
|
||||
|
|
|
@ -91,10 +91,15 @@ const CollectionProducts = withStyles(styles, { name: "CollectionProducts" })(
|
|||
<CardTitle
|
||||
title={
|
||||
!!collection ? (
|
||||
intl.formatMessage({
|
||||
intl.formatMessage(
|
||||
{
|
||||
defaultMessage: "Products in {name}",
|
||||
description: "products in collection"
|
||||
})
|
||||
},
|
||||
{
|
||||
name: maybe(() => collection.name, "...")
|
||||
}
|
||||
)
|
||||
) : (
|
||||
<Skeleton />
|
||||
)
|
||||
|
|
|
@ -12,7 +12,7 @@ import TableRow from "@material-ui/core/TableRow";
|
|||
import Typography from "@material-ui/core/Typography";
|
||||
import KeyboardArrowRight from "@material-ui/icons/KeyboardArrowRight";
|
||||
import React from "react";
|
||||
import { FormattedMessage, useIntl } from "react-intl";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
import Skeleton from "@saleor/components/Skeleton";
|
||||
|
||||
|
@ -46,10 +46,7 @@ const HomeNotificationTable = withStyles(styles, {
|
|||
ordersToCapture,
|
||||
ordersToFulfill,
|
||||
productsOutOfStock
|
||||
}: HomeNotificationTableProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
}: HomeNotificationTableProps) => (
|
||||
<Card>
|
||||
<Table>
|
||||
<TableBody className={classes.tableRow}>
|
||||
|
@ -146,8 +143,7 @@ const HomeNotificationTable = withStyles(styles, {
|
|||
</TableBody>
|
||||
</Table>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
)
|
||||
);
|
||||
HomeNotificationTable.displayName = "HomeNotificationTable";
|
||||
export default HomeNotificationTable;
|
||||
|
|
|
@ -86,8 +86,8 @@ const OrderFulfillment = withStyles(styles, { name: "OrderFulfillment" })(
|
|||
const lines = maybe(() => fulfillment.lines);
|
||||
const status = maybe(() => fulfillment.status);
|
||||
const quantity = lines
|
||||
.map(line => line.quantity)
|
||||
.reduce((prev, curr) => prev + curr, 0);
|
||||
? lines.map(line => line.quantity).reduce((prev, curr) => prev + curr, 0)
|
||||
: "...";
|
||||
|
||||
return (
|
||||
<Card>
|
||||
|
|
|
@ -3,7 +3,7 @@ import CardContent from "@material-ui/core/CardContent";
|
|||
import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import React from "react";
|
||||
import { FormattedMessage, useIntl } from "react-intl";
|
||||
import { useIntl } from "react-intl";
|
||||
|
||||
import CardTitle from "@saleor/components/CardTitle";
|
||||
import FormSpacer from "@saleor/components/FormSpacer";
|
||||
|
|
|
@ -263,6 +263,10 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
|||
loading={disabled}
|
||||
onClick={onSeoClick}
|
||||
onChange={change}
|
||||
helperText={intl.formatMessage({
|
||||
defaultMessage:
|
||||
"Add search engine title and description to make this product easier to find"
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -9,7 +9,7 @@ import Decorator from "../../Decorator";
|
|||
|
||||
const shop = shopFixture(placeholderImage);
|
||||
|
||||
const HomePageProps: Omit<HomePageProps, "classes"> = {
|
||||
const homePageProps: Omit<HomePageProps, "classes"> = {
|
||||
activities: shop.activities.edges.map(edge => edge.node),
|
||||
onOrdersToCaptureClick: () => undefined,
|
||||
onOrdersToFulfillClick: () => undefined,
|
||||
|
@ -26,10 +26,10 @@ const HomePageProps: Omit<HomePageProps, "classes"> = {
|
|||
|
||||
storiesOf("Views / HomePage", module)
|
||||
.addDecorator(Decorator)
|
||||
.add("default", () => <HomePage {...HomePageProps} />)
|
||||
.add("default", () => <HomePage {...homePageProps} />)
|
||||
.add("loading", () => (
|
||||
<HomePage
|
||||
{...HomePageProps}
|
||||
{...homePageProps}
|
||||
activities={undefined}
|
||||
orders={undefined}
|
||||
ordersToCapture={undefined}
|
||||
|
@ -41,5 +41,5 @@ storiesOf("Views / HomePage", module)
|
|||
/>
|
||||
))
|
||||
.add("no data", () => (
|
||||
<HomePage {...HomePageProps} topProducts={[]} activities={[]} />
|
||||
<HomePage {...homePageProps} topProducts={[]} activities={[]} />
|
||||
));
|
||||
|
|
Loading…
Reference in a new issue