Last active
May 13, 2020 19:47
-
-
Save danizavtz/1ebc8bf698d4cfe9d097fc8f8812b447 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let tokn = null //essa é variável global durante a execução dos testes que irá armazenar o token | |
... | |
before(function(done) { | |
api.post('/ingefood/login') | |
.send({ | |
"login": "teste", | |
"password": "essaéaminhasenhasuperseguraparaseauthenticarnestaapi." | |
}) | |
.expect(200) | |
.end(function(err, res) { | |
tokn = res.body; | |
done(); | |
}); | |
}); | |
... | |
it('Return all categories instances', function(done) { | |
api.get(_url) | |
.set('Authorization', 'Bearer '+tokn) | |
.expect(200) | |
.end(function(err, res) { | |
expect(res.body).to.be.instanceof(Array); | |
expect(res.body.length).to.equal(1); | |
done(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment