From 0e78f34d155ca26b0ebbdb03df20fd61f7eb6a43 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 16 Apr 2019 03:59:21 +0200 Subject: [PATCH] add more tests --- jest/__fixtures__/meta.json | 3 + package.json | 1 + src/components/Layout.jsx | 73 ++++++++++--------- src/components/atoms/Vcard.jsx | 14 ++-- src/components/atoms/Vcard.test.jsx | 37 ++++++++++ src/components/molecules/ThemeSwitch.jsx | 5 +- src/components/molecules/ThemeSwitch.test.jsx | 17 +++++ src/components/organisms/Footer.jsx | 23 ++++-- src/store/provider.jsx | 34 ++++----- 9 files changed, 139 insertions(+), 68 deletions(-) create mode 100644 src/components/atoms/Vcard.test.jsx create mode 100644 src/components/molecules/ThemeSwitch.test.jsx diff --git a/jest/__fixtures__/meta.json b/jest/__fixtures__/meta.json index 1ad3618..c4704af 100644 --- a/jest/__fixtures__/meta.json +++ b/jest/__fixtures__/meta.json @@ -9,6 +9,9 @@ "childImageSharp": { "fluid": { "src": "/static/b45f45aa8d98d4e4019a242d38f2f248/bc3a8/avatar.jpg" + }, + "resize": { + "src": "/static/b45f45aa8d98d4e4019a242d38f2f248/bc3a8/avatar.jpg" } } }, diff --git a/package.json b/package.json index 4700725..44e8ef0 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "format": "prettier --write 'src/**/*.{js,jsx}'", "format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'", "test": "npm run lint && jest --coverage", + "test:watch": "npm run lint && jest --coverage --watch", "deploy": "./scripts/deploy.sh", "new": "babel-node ./scripts/new.js" }, diff --git a/src/components/Layout.jsx b/src/components/Layout.jsx index 999de04..837bd65 100644 --- a/src/components/Layout.jsx +++ b/src/components/Layout.jsx @@ -25,59 +25,62 @@ const query = graphql` } ` -const LayoutMarkup = ({ children, isHomepage, allowedHosts, location }) => ( - <> - - +const LayoutMarkup = ({ children, data, location }) => { + const { allowedHosts } = data.contentYaml + const isHomepage = location.pathname === '/' - - -
-
{children}
- - + return ( + <> + + -