From 7ca3046a3371dea58e405f538182351c8a2d46be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcholas=20Andr=C3=A9?= Date: Wed, 24 Feb 2021 09:51:14 -0300 Subject: [PATCH 1/2] Setting up test suit and adding an example test --- themes/10up-theme/.eslintrc | 8 +- .../__mocks__/@wordpress/block-editor.js | 6 + .../10up-theme/__mocks__/@wordpress/i18n.js | 3 + themes/10up-theme/babel.config.js | 3 + .../blocks/example-block/__tests__/edit.js | 21 + themes/10up-theme/jest-unit.config.js | 4 + themes/10up-theme/package-lock.json | 1123 ++++++++++++----- themes/10up-theme/package.json | 9 +- themes/10up-theme/setupTests.js | 2 + 9 files changed, 869 insertions(+), 310 deletions(-) create mode 100644 themes/10up-theme/__mocks__/@wordpress/block-editor.js create mode 100644 themes/10up-theme/__mocks__/@wordpress/i18n.js create mode 100644 themes/10up-theme/babel.config.js create mode 100644 themes/10up-theme/includes/blocks/example-block/__tests__/edit.js create mode 100644 themes/10up-theme/jest-unit.config.js create mode 100644 themes/10up-theme/setupTests.js diff --git a/themes/10up-theme/.eslintrc b/themes/10up-theme/.eslintrc index f9985ee2..2b588d41 100644 --- a/themes/10up-theme/.eslintrc +++ b/themes/10up-theme/.eslintrc @@ -1,3 +1,9 @@ { - "extends": ["@10up/eslint-config/wordpress"] + "settings": { + "jest": { + "version": 25, + "react": 17 + } + }, + "extends": ["@10up/eslint-config/wordpress", "@10up/eslint-config/jest"] } diff --git a/themes/10up-theme/__mocks__/@wordpress/block-editor.js b/themes/10up-theme/__mocks__/@wordpress/block-editor.js new file mode 100644 index 00000000..6a695ee3 --- /dev/null +++ b/themes/10up-theme/__mocks__/@wordpress/block-editor.js @@ -0,0 +1,6 @@ +/* eslint-disable react/prop-types */ +const RichText = ({ onChange }) =>