Skip to content

Commit

Permalink
fix test promise
Browse files Browse the repository at this point in the history
  • Loading branch information
CiccioTecchio committed Dec 15, 2018
1 parent f38d6ba commit 85df355
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion server/package.json
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"start": "node ./bin/www",
"test": "nyc mocha --timeout 30000 --exit && ./node_modules/.bin/eslint --fix app.js routes/** test/**.js model/**.js signleton/**.js",
"test": "nyc mocha --exit && ./node_modules/.bin/eslint --fix app.js routes/** test/**.js model/**.js signleton/**.js",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"dependencies": {
Expand Down
21 changes: 11 additions & 10 deletions server/test/observer.test.js
Expand Up @@ -55,25 +55,26 @@ it('GET ACCEDUTO: it expects to receive an object', function(done){
});
});

it('POST ACCEDE: it expects to receive an object', function(done){
it('POST ACCEDE: it expects to receive an object', (done) => {
let obj={username:"Ciccio", password:"1234"};
chai.request(server)
.post('/observer/accede')
.send(obj)
.end(function(err, res){
res.should.have.status(200);
.then((res) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
done();
});
})
.end(done());
});

it('ACCEDE: it expects to receive a status 400', function(done){
it('ACCEDE: it expects to receive a status 404', (done) => {
let obj={username:"Ciccio", password:"12345"};
chai.request(server)
.post('/observer/accede')
.send(obj)
.end(function(err, res){
res.should.have.status(404);
done();
});
.then((res) => {
expect(res).to.have.status(404);
expect(res.body).to.be.an('object');
})
.end(done());
});

0 comments on commit 85df355

Please sign in to comment.