Fix Travis
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "10"
|
- node
|
4
index.js
4
index.js
@@ -58,7 +58,7 @@ app.post('/files/ls',(req,res,next)=>{
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
res.json({"error":"Access denied","loc":'/'})
|
res.status(404).json({"error":"Access denied","loc":'/'})
|
||||||
}
|
}
|
||||||
|
|
||||||
//next()
|
//next()
|
||||||
@@ -86,3 +86,5 @@ app.all('*',(req,res)=>{
|
|||||||
app.listen(port,()=>{
|
app.listen(port,()=>{
|
||||||
console.log(`Listening : ${port}`)
|
console.log(`Listening : ${port}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
module.exports = app;
|
1063
package-lock.json
generated
1063
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node .",
|
"start": "node .",
|
||||||
"test": "node test"
|
"test": "mocha test.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -23,8 +23,11 @@
|
|||||||
"homepage": "https://github.com/chrisvrose/nodejs-fm#readme",
|
"homepage": "https://github.com/chrisvrose/nodejs-fm#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
|
"chai": "^4.2.0",
|
||||||
|
"chai-http": "^4.3.0",
|
||||||
"express": "^4.17.0",
|
"express": "^4.17.0",
|
||||||
"jquery": "^3.4.1",
|
"jquery": "^3.4.1",
|
||||||
|
"mocha": "^6.1.4",
|
||||||
"requests": "^0.2.2"
|
"requests": "^0.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
test.js
30
test.js
@@ -1 +1,31 @@
|
|||||||
|
const chai = require('chai')
|
||||||
|
const chai_http = require('chai-http')
|
||||||
const requests = require('requests')
|
const requests = require('requests')
|
||||||
|
const testScript = require('./index')
|
||||||
|
|
||||||
|
|
||||||
|
chai.use(chai_http)
|
||||||
|
|
||||||
|
let should = require('chai').should()
|
||||||
|
|
||||||
|
describe('Page Status',()=>{
|
||||||
|
it('Get /',(done)=>{
|
||||||
|
chai.request(testScript).get('/').end((err,res)=>{
|
||||||
|
res.should.have.status(200)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
it('POST /files/ls the home page',(done)=>{
|
||||||
|
chai.request(testScript).post('/files/ls').send({'loc':'/'}).end((err,res)=>{
|
||||||
|
res.should.have.status(200)
|
||||||
|
//TODO: MAKE SURE JSON FILE
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
it('POST ../ and fetch error',done=>{
|
||||||
|
chai.request(testScript).post('/files/ls').send({'loc':'../'}).end((err,res)=>{
|
||||||
|
res.should.have.status(404)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
Reference in New Issue
Block a user