Fix tests

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2021-08-24 10:36:38 +02:00
parent 21e18660eb
commit 3468cbfa35
10 changed files with 123 additions and 16 deletions

View File

@ -82,8 +82,8 @@ describe('Admin | components | AuthenticatedApp', () => {
border: 6px solid #f3f3f3;
border-top: 6px solid #1c91e7;
border-radius: 50%;
-webkit-animation: fEWCgj 2s linear infinite;
animation: fEWCgj 2s linear infinite;
-webkit-animation: cilQsd 2s linear infinite;
animation: cilQsd 2s linear infinite;
}
<div

View File

@ -294,8 +294,8 @@ describe('Content manager | App | main', () => {
border: 6px solid #f3f3f3;
border-top: 6px solid #1c91e7;
border-radius: 50%;
-webkit-animation: fEWCgj 2s linear infinite;
animation: fEWCgj 2s linear infinite;
-webkit-animation: cilQsd 2s linear infinite;
animation: cilQsd 2s linear infinite;
}
.c0 {

View File

@ -37,8 +37,8 @@ describe('ADMIN | StrapiApp', () => {
border: 6px solid #f3f3f3;
border-top: 6px solid #1c91e7;
border-radius: 50%;
-webkit-animation: fEWCgj 2s linear infinite;
animation: fEWCgj 2s linear infinite;
-webkit-animation: cilQsd 2s linear infinite;
animation: cilQsd 2s linear infinite;
}
<div

View File

@ -0,0 +1,18 @@
const defaultPresets = [
[
'@babel/preset-env',
{
modules: 'commonjs',
},
],
];
module.exports = {
presets: defaultPresets.concat(['@babel/preset-react', '@babel/preset-flow']),
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-function-bind',
],
};

View File

@ -2,8 +2,8 @@
"name": "@strapi/helper-plugin",
"version": "3.6.6",
"description": "Helper for Strapi plugins development",
"main": "build/index.js",
"module": "build/index.esm.js",
"main": "build/helper-plugin.js",
"module": "lib/src/index.js",
"files": [
"build"
],
@ -27,8 +27,10 @@
"scripts": {
"prepublishOnly": "npm run build",
"prebuild": "rimraf build",
"build": "rollup -c",
"watch": "rollup -c -w",
"build": "webpack-cli",
"build:rollup": "rollup -c",
"watch": "webpack-cli -w",
"watch:rollup": "rollup -c -w",
"test": "echo \"no tests yet\"",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
@ -41,6 +43,8 @@
"devDependencies": {
"@babel/core": "7.14.0",
"@babel/plugin-proposal-class-properties": "7.13.0",
"@babel/plugin-proposal-export-default-from": "7.14.5",
"@babel/plugin-proposal-function-bind": "7.14.5",
"@babel/plugin-transform-runtime": "7.13.15",
"@babel/preset-env": "7.14.0",
"@babel/preset-react": "7.13.13",
@ -80,6 +84,8 @@
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"@rollup/plugin-image": "2.0.6",
"@strapi/icons": "0.0.1-alpha.15",
"@strapi/parts": "0.0.1-alpha.15",
"axios": "0.21.1",
"babel-plugin-styled-components": "1.12.0",
"classnames": "^2.3.1",
@ -87,6 +93,7 @@
"immutable": "^3.8.2",
"invariant": "^2.2.1",
"lodash": "4.17.21",
"match-sorter": "^4.0.2",
"moment": "^2.29.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",

View File

@ -0,0 +1,65 @@
const webpack = require('webpack');
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const packageJson = require('./package.json');
const nodeModules = [];
[
...Object.keys(packageJson.dependencies),
...Object.keys(packageJson.peerDependencies),
...Object.keys(packageJson.devDependencies),
].forEach(module => {
nodeModules.push(new RegExp(`^${module}(/.+)?$`));
});
module.exports = {
entry: `${__dirname}/lib/src/index.js`,
externals: nodeModules,
// mode: process.env.NODE_ENV,
mode: 'production',
devtool: 'source-map',
output: {
path: `${__dirname}/build`,
filename: `helper-plugin.js`,
library: {
name: 'helperPlugin',
type: 'umd',
},
umdNamedDefine: true,
},
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, 'lib', 'src'),
loader: 'babel-loader',
exclude: /(node_modules)/,
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|svg|jpg|gif)$/,
loader: 'url-loader',
options: {
limit: 8192,
},
},
],
},
resolve: {
extensions: ['*', '.js'],
cacheWithContext: false,
},
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'production',
}),
new MiniCssExtractPlugin({
filename: 'style.css',
}),
],
};

View File

@ -6,7 +6,7 @@ const addColumnToTableHook = ({ displayedHeaders, layout }) => {
const isFieldLocalized = get(layout, 'contentType.pluginOptions.i18n.localized', false);
if (!isFieldLocalized) {
return displayedHeaders;
return { displayedHeaders, layout };
}
return {

View File

@ -9,8 +9,10 @@ describe('i18n | contentManagerHooks | addColumnToTable', () => {
const result = addColumnToTable({ displayedHeaders, layout });
expect(result).toHaveLength(1);
expect(result).toEqual(['one']);
expect(result).toHaveProperty('displayedHeaders');
expect(result).toHaveProperty('layout');
expect(result.displayedHeaders).toHaveLength(1);
expect(result.displayedHeaders).toEqual(['one']);
});
it('adds a header to the displayedHeaders array when the content type is localized', () => {

View File

@ -54,8 +54,8 @@ describe('Admin | containers | ProvidersPage', () => {
border: 6px solid #f3f3f3;
border-top: 6px solid #1c91e7;
border-radius: 50%;
-webkit-animation: fEWCgj 2s linear infinite;
animation: fEWCgj 2s linear infinite;
-webkit-animation: cilQsd 2s linear infinite;
animation: cilQsd 2s linear infinite;
}
.c1 {

View File

@ -608,7 +608,7 @@
"@babel/helper-plugin-utils" "^7.14.5"
"@babel/plugin-syntax-dynamic-import" "^7.8.3"
"@babel/plugin-proposal-export-default-from@^7.12.1":
"@babel/plugin-proposal-export-default-from@7.14.5", "@babel/plugin-proposal-export-default-from@^7.12.1":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.14.5.tgz#8931a6560632c650f92a8e5948f6e73019d6d321"
integrity sha512-T8KZ5abXvKMjF6JcoXjgac3ElmXf0AWzJwi2O/42Jk+HmCky3D9+i1B7NPP1FblyceqTevKeV/9szeikFoaMDg==
@ -624,6 +624,14 @@
"@babel/helper-plugin-utils" "^7.14.5"
"@babel/plugin-syntax-export-namespace-from" "^7.8.3"
"@babel/plugin-proposal-function-bind@7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-function-bind/-/plugin-proposal-function-bind-7.14.5.tgz#83bbc684312bf82bda46ec7cb52dc226e891833f"
integrity sha512-PSQk5JImi81nFAzIebCEqkd0aiP9LDVKLCIH+0yR66JV8cQ1oZ8IRK9NNaA5nw9sjo0cPXxuBPCqgqcpugR8tA==
dependencies:
"@babel/helper-plugin-utils" "^7.14.5"
"@babel/plugin-syntax-function-bind" "^7.14.5"
"@babel/plugin-proposal-json-strings@^7.13.8", "@babel/plugin-proposal-json-strings@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.14.5.tgz#38de60db362e83a3d8c944ac858ddf9f0c2239eb"
@ -782,6 +790,13 @@
dependencies:
"@babel/helper-plugin-utils" "^7.14.5"
"@babel/plugin-syntax-function-bind@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-function-bind/-/plugin-syntax-function-bind-7.14.5.tgz#eb7544014fe349f48acbebc5084eeadde2efe57e"
integrity sha512-gstAIrKtlPwrQaRz4uK+kT7zI2p5MQqX41SeO+kZKH1XGO1jL0nLZBWznRigPpkem6LfIoG2EduQZmPBcUwEmg==
dependencies:
"@babel/helper-plugin-utils" "^7.14.5"
"@babel/plugin-syntax-import-meta@^7.8.3":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51"