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.js build output
.next .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", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@material-ui/core": "^3.2.0", "@material-ui/core": "^4.11.0",
"@material-ui/icons": "^3.0.1", "@material-ui/icons": "^4.9.1",
"@redux-offline/redux-offline": "^2.5.2", "@redux-offline/redux-offline": "^2.6.0",
"http-proxy-middleware": "^0.20.0", "http-proxy-middleware": "^1.0.5",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^16.9.0", "react": "^16.13.1",
"react-dom": "^16.9.0", "react-dom": "^16.13.1",
"react-loadable": "^5.5.0", "react-loadable": "^5.5.0",
"react-redux": "^5.0.7", "react-redux": "^7.2.1",
"react-router-dom": "^4.3.1", "react-router-dom": "^5.2.0",
"react-router-redux": "^4.0.8", "react-router-redux": "^4.0.8",
"react-scripts": "2.0.4", "react-scripts": "3.4.3",
"react-spring": "^5.9.2", "react-spring": "^5.0.0",
"redux": "^4.0.4", "redux": "^4.0.5",
"redux-form": "^7.4.2", "redux-form": "^8.3.6",
"redux-thunk": "^2.3.0" "redux-thunk": "^2.3.0"
}, },
"scripts": { "scripts": {

View File

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

View File

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

View File

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