update pretty much everything

update tests to workaround (I think) this thing https://github.com/facebook/jest/issues/9624
didn't update react-spring because too lazy
This commit is contained in:
2020-08-14 14:44:44 +03:00
parent 1d0e51f673
commit 052256788e
9 changed files with 11617 additions and 14568 deletions

2
.gitignore vendored
View File

@@ -59,3 +59,5 @@ typings/
# next.js build output
.next
.history

17404
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,21 +3,21 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^3.2.0",
"@material-ui/icons": "^3.0.1",
"@redux-offline/redux-offline": "^2.5.2",
"http-proxy-middleware": "^0.20.0",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@redux-offline/redux-offline": "^2.6.0",
"http-proxy-middleware": "^1.0.5",
"prop-types": "^15.7.2",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-loadable": "^5.5.0",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"react-redux": "^7.2.1",
"react-router-dom": "^5.2.0",
"react-router-redux": "^4.0.8",
"react-scripts": "2.0.4",
"react-spring": "^5.9.2",
"redux": "^4.0.4",
"redux-form": "^7.4.2",
"react-scripts": "3.4.3",
"react-spring": "^5.0.0",
"redux": "^4.0.5",
"redux-form": "^8.3.6",
"redux-thunk": "^2.3.0"
},
"scripts": {

View File

@@ -1,5 +1,5 @@
const proxy = require('http-proxy-middleware');
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(proxy('/__', { target: 'http://localhost:4000/' }));
app.use(createProxyMiddleware('/__', { target: 'http://localhost:4000/' }));
};

9215
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
"main": "app.js",
"scripts": {
"start": "node ./app.js",
"dev": "npx concurrently \"npm run server\" \"npm run client\" ",
"dev": "npx concurrently npm:client npm:server -c 'blue,green'",
"client": "cd client && npm start",
"server": "npx cross-env NODE_ENV=development npx nodemon --inspect ./app.js",
"test": "npx cross-env NODE_ENV=test jest",
@@ -24,36 +24,36 @@
"body-parser": "^1.19.0",
"compression": "^1.7.4",
"cors": "^2.8.5",
"dotenv": "^8.1.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-http-to-https": "^1.1.4",
"express-jwt": "^5.3.1",
"express-jwt": "^6.0.0",
"hsts": "^2.2.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.7.5",
"mongoose": "^5.9.29",
"mongoose-findorcreate": "^3.0.0",
"mongoose-unique-validator": "^2.0.3",
"morgan": "^1.9.1",
"passport": "^0.4.0",
"passport-google-oauth": "^1.0.0",
"morgan": "^1.10.0",
"passport": "^0.4.1",
"passport-google-oauth": "^2.0.0",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^5.0.1"
"passport-local-mongoose": "^6.0.1"
},
"devDependencies": {
"concurrently": "^4.1.2",
"cross-env": "^5.2.1",
"eslint": "5.6.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.17.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "^7.14.3",
"jest": "^23.6.0",
"mongodb-memory-server": "^2.9.1",
"nodemon": "^1.19.2",
"prettier-eslint": "^9.0.0",
"concurrently": "^5.3.0",
"cross-env": "^7.0.2",
"eslint": "^6.0.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"jest": "^24.0.0",
"mongodb-memory-server": "^6.6.3",
"nodemon": "^2.0.4",
"prettier-eslint": "^11.0.0",
"supertest": "^4.0.2"
},
"jest": {

View File

@@ -2,6 +2,6 @@ const jwt = require('express-jwt');
const { secret } = require('../config');
module.exports = {
required: jwt({ secret }),
optional: jwt({ secret, credentialsRequired: false }),
required: jwt({ secret, algorithms: ['HS256'] }),
optional: jwt({ secret, credentialsRequired: false, algorithms: ['HS256'] }),
};

View File

@@ -71,7 +71,7 @@ describe('test lists', () => {
expect(response.body.success).toBeTruthy();
expect(await TodoList.findOne({ name: 'List2' })).toBeTruthy();
const freshUser = await User.findById(user.id).exec();
expect(freshUser.lists).toContain(response.body.data.id);
expect(freshUser.lists.map(l => String(l))).toContain(response.body.data.id);
});
test('should create list with custom id', async () => {
const id = mongoose.Types.ObjectId();
@@ -89,7 +89,7 @@ describe('test lists', () => {
expect(response.body.success).toBeTruthy();
expect(await TodoList.findOne({ name: 'List2', _id: id })).toBeTruthy();
const freshUser = await User.findById(user.id).exec();
expect(freshUser.lists).toContain(response.body.data.id);
expect(freshUser.lists.map(l => String(l))).toContain(response.body.data.id);
});
test('should not create list without authentication', async () => {
@@ -151,7 +151,7 @@ describe('test lists', () => {
expect(await TodoList.findOne({ name: 'List1' }).exec()).toBeTruthy();
expect(await Todo.findOne({ text: 'Todo1' }).exec()).toBeTruthy();
const freshUser = await User.findById(user.id).exec();
expect(freshUser.lists).toContain(list._id);
expect(freshUser.todos).toContain(todo._id);
expect(freshUser.lists.map(l => String(l))).toContain(String(list._id));
expect(freshUser.todos.map(t => String(t))).toContain(String(todo._id));
});
});

View File

@@ -82,9 +82,9 @@ describe('test todos', () => {
expect(response.body.success).toBeTruthy();
expect(await Todo.findOne({ text: 'Todo2', list: list._id })).toBeTruthy();
const freshUser = await User.findById(user.id).exec();
expect(freshUser.todos).toContain(response.body.data.id);
expect(freshUser.todos.map(t => String(t))).toContain(response.body.data.id);
const freshList = await TodoList.findById(list.id).exec();
expect(freshList.todos).toContain(response.body.data.id);
expect(freshList.todos.map(t => String(t))).toContain(response.body.data.id);
});
test('should create todo with custom id', async () => {
const id = mongoose.Types.ObjectId();
@@ -104,9 +104,9 @@ describe('test todos', () => {
await Todo.findOne({ text: 'Todo2', list: list._id, _id: id }),
).toBeTruthy();
const freshUser = await User.findById(user.id).exec();
expect(freshUser.todos).toContain(response.body.data.id);
expect(freshUser.todos.map(t => String(t))).toContain(response.body.data.id);
const freshList = await TodoList.findById(list.id).exec();
expect(freshList.todos).toContain(response.body.data.id);
expect(freshList.todos.map(t => String(t))).toContain(response.body.data.id);
});
test('should not create todo without authentication', async () => {
await request(server)