Upload 4.8
This commit is contained in:
562
part4/bloglist/package-lock.json
generated
562
part4/bloglist/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,21 +4,27 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index.js",
|
"start": "cross-env NODE_ENV=production node index.js",
|
||||||
"test": "jest --verbose",
|
"dev": "cross-env NODE_ENV=development nodemon index.js",
|
||||||
"dev": "nodemon index.js"
|
"test": "cross-env NODE_ENV=test jest --verbose --runInBand"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
"dotenv": "^16.1.1",
|
"dotenv": "^16.1.1",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"jest": "^29.5.0",
|
|
||||||
"mongoose": "^7.2.2"
|
"mongoose": "^7.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.41.0",
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
part4/bloglist/tests/blog_api.test.js
Normal file
16
part4/bloglist/tests/blog_api.test.js
Normal 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()
|
||||||
|
})
|
||||||
3
part4/bloglist/tests/teardown.js
Normal file
3
part4/bloglist/tests/teardown.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = () => {
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user