Updates test implementation

This commit is contained in:
Ivan Diaz 2019-08-04 18:03:06 +02:00
parent 596aaf6a7f
commit 0278da8942
6 changed files with 17 additions and 32 deletions

View File

@ -12,7 +12,6 @@ services:
before_install: before_install:
- rvm use 2.6 --install --binary --fuzzy - rvm use 2.6 --install --binary --fuzzy
- ruby --version - ruby --version
- apt-get install ruby-bundler
- mysql -e 'CREATE DATABASE development;' - mysql -e 'CREATE DATABASE development;'
- nvm install 6.14.4 - nvm install 6.14.4
- npm install -g npm@6.1.0 - npm install -g npm@6.1.0

View File

@ -1,4 +1,4 @@
{ {
"presets": ["@babel/preset-env", "@babel/preset-react"], "presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-class-properties"] "plugins": ["@babel/plugin-proposal-class-properties", "add-module-exports"]
} }

View File

@ -16,22 +16,20 @@
"start": "webpack-dev-server", "start": "webpack-dev-server",
"start-fixtures": "webpack-dev-server --env.FIXTURES=1", "start-fixtures": "webpack-dev-server --env.FIXTURES=1",
"build": "rimraf build && NODE_ENV=production webpack -p --devtool none", "build": "rimraf build && NODE_ENV=production webpack -p --devtool none",
"test": "export NODE_PATH=src && mocha src/lib-test/preprocessor.js --compilers js:babel-core/register --recursive src/**/**/__tests__/*-test.js" "test": "export NODE_PATH=src && mocha src/lib-test/preprocessor.js --require @babel/register --recursive src/**/**/__tests__/*-test.js"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.4.5", "@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/node": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.4.4", "@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5", "@babel/plugin-transform-modules-commonjs": "^7.5.0",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0", "@babel/preset-react": "^7.0.0",
"@babel/register": "^7.5.5",
"axios-mock-adapter": "^1.15.0", "axios-mock-adapter": "^1.15.0",
"babel-core": "^5.8.22", "babel-plugin-add-module-exports": "^1.0.2",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.6",
"babel-plugin-transform-class-properties": "^6.11.5",
"babel-register": "^6.7.2",
"babelify": "^6.1.x",
"browser-sync": "^2.7.13", "browser-sync": "^2.7.13",
"browserify": "^10.2.6",
"chai": "^3.5.0", "chai": "^3.5.0",
"copy-webpack-plugin": "^5.0.3", "copy-webpack-plugin": "^5.0.3",
"css-loader": "^3.0.0", "css-loader": "^3.0.0",
@ -42,24 +40,12 @@
"express": "^4.13.1", "express": "^4.13.1",
"express-http-proxy": "^0.6.0", "express-http-proxy": "^0.6.0",
"file-loader": "^4.0.0", "file-loader": "^4.0.0",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-connect-php": "0.0.5",
"gulp-if": "^1.2.5",
"gulp-imagemin": "^2.3.0",
"gulp-notify": "^2.2.0",
"gulp-plumber": "^1.2.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^4.0.1",
"gulp-sass-bulk-import": "^1.0.1",
"gulp-sourcemaps": "^2.6.4",
"gulp-streamify": "0.0.5",
"gulp-uglify": "^2.1.2",
"gulp-util": "^3.0.6",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"humps": "^0.6.0", "humps": "^0.6.0",
"jsdom": "^8.4.1", "jsdom": "^8.4.1",
"mocha": "^6.2.0",
"morgan": "^1.6.1", "morgan": "^1.6.1",
"nodemon": "^1.19.1",
"path": "^0.12.7", "path": "^0.12.7",
"proxyquire": "^1.7.4", "proxyquire": "^1.7.4",
"react-addons-test-utils": "^15.0.1", "react-addons-test-utils": "^15.0.1",

View File

@ -111,7 +111,7 @@ class App extends React.Component {
history.push('/admin'); history.push('/admin');
} }
if(/*isProd &&*/ _.includes(props.location.pathname, '/components-demo')) { if(proccess.env.NODE_ENV === 'production' && _.includes(props.location.pathname, '/components-demo')) {
history.push('/'); history.push('/');
} }
} }

View File

@ -74,7 +74,7 @@ class MainRecoverPasswordPage extends React.Component {
}).then(this.onPasswordRecovered.bind(this)).catch(this.onPasswordRecoverFail.bind(this)); }).then(this.onPasswordRecovered.bind(this)).catch(this.onPasswordRecoverFail.bind(this));
} }
onPasswordRecovered(response) { onPasswordRecovered(response = {data: {}}) {
setTimeout(() => {history.push((response.data.staff*1) ? '/admin' : '/')}, 2000); setTimeout(() => {history.push((response.data.staff*1) ? '/admin' : '/')}, 2000);
this.setState({ this.setState({
recoverStatus: 'valid', recoverStatus: 'valid',

View File

@ -2,12 +2,12 @@
var jsdom = require('jsdom').jsdom; var jsdom = require('jsdom').jsdom;
global.document = jsdom('<html><body></body></html>'); global.document = jsdom('<html><body></body></html>', {
url: 'http://localhost'
});
global.window = document.defaultView; global.window = document.defaultView;
global.Node = global.window.Node; global.Node = global.window.Node;
global.navigator = { global.navigator = global.window.navigator;
userAgent: 'node.js'
};
global.React = require('react'); global.React = require('react');
global.ReactDOM = require('react-dom'); global.ReactDOM = require('react-dom');
global.chai = require('chai'); global.chai = require('chai');