0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Refactored Admin API test agent to use async/await

no issue

- Improves readability of what's going on in the code.
This commit is contained in:
Naz 2022-06-01 13:34:20 +08:00
parent 6271e2f5f3
commit 29e5d08210

View file

@ -20,13 +20,13 @@ class AdminAPITestAgent extends TestAgent {
}
async loginAs(email, password) {
await this.post('/session/')
const res = await this.post('/session/')
.body({
grant_type: 'password',
username: email,
password: password
})
.then(function then(res) {
});
if (res.statusCode === 302) {
// This can happen if you already have an instance running e.g. if you've been using Ghost CLI recently
throw new errors.IncorrectUsageError({
@ -39,7 +39,6 @@ class AdminAPITestAgent extends TestAgent {
}
return res.headers['set-cookie'];
});
}
async loginAsOwner() {