Upload 4.8

This commit is contained in:
Andrew Trieu
2023-05-31 15:20:53 +03:00
parent 4dda427795
commit 31436ad7fa
4 changed files with 547 additions and 50 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,21 +4,27 @@
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "jest --verbose",
"dev": "nodemon index.js"
"start": "cross-env NODE_ENV=production node index.js",
"dev": "cross-env NODE_ENV=development nodemon index.js",
"test": "cross-env NODE_ENV=test jest --verbose --runInBand"
},
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"dotenv": "^16.1.1",
"express": "^4.18.2",
"jest": "^29.5.0",
"mongoose": "^7.2.2"
},
"devDependencies": {
"eslint": "^8.41.0",
"nodemon": "^2.0.22"
"jest": "^29.5.0",
"nodemon": "^2.0.22",
"supertest": "^6.3.3"
},
"jest": {
"testEnvironment": "node",
"globalTeardown": "./tests/teardown.js"
}
}

View File

@@ -0,0 +1,16 @@
const mongoose = require('mongoose')
const supertest = require('supertest')
const app = require('../app')
const api = supertest(app)
test('blogs are returned as json', async () => {
await api
.get('/api/blogs')
.expect(200)
.expect('Content-Type', /application\/json/)
})
afterAll(async () => {
await mongoose.connection.close()
})

View File

@@ -0,0 +1,3 @@
module.exports = () => {
process.exit(0)
}