0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Refactored authentication test suite to serverless boot

refs https://github.com/TryGhost/Toolbox/issues/152

- This is a continuation of an experiment to switch over to serverless boot in regression tests. Just a proofe of concept that authentication scenarios would also work and the expectations don't collapse unexpectedly.
- Nothing too crazy so far, easy and straight forward substitution of the config "url" with an express app passed to the supertest agent
This commit is contained in:
Naz 2021-12-06 15:46:51 +04:00 committed by naz
parent 4a1bee0a01
commit b7231875a0

View file

@ -11,11 +11,11 @@ const mailService = require('../../../../../core/server/services/mail/index');
let request;
describe('Authentication API v3', function () {
describe('Authentication API canary', function () {
describe('Blog setup', function () {
before(async function () {
await localUtils.startGhost({forceStart: true});
request = supertest.agent(config.get('url'));
const app = await localUtils.startGhost({forceStart: true});
request = supertest.agent(app);
});
beforeEach(function () {
@ -132,14 +132,11 @@ describe('Authentication API v3', function () {
});
describe('Invitation', function () {
before(function () {
return localUtils.startGhost()
.then(function () {
request = supertest.agent(config.get('url'));
before(async function () {
const app = await localUtils.startGhost();
request = supertest.agent(app);
// simulates blog setup (initialises the owner)
return localUtils.doAuth(request, 'invites');
});
await localUtils.doAuth(request, 'invites');
});
it('check invite with invalid email', function () {
@ -227,14 +224,11 @@ describe('Authentication API v3', function () {
describe('Password reset', function () {
const user = testUtils.DataGenerator.forModel.users[0];
before(function () {
return localUtils.startGhost({forceStart: true})
.then(() => {
request = supertest.agent(config.get('url'));
})
.then(() => {
return localUtils.doAuth(request);
});
before(async function () {
const app = await localUtils.startGhost({forceStart: true});
request = supertest.agent(app);
await localUtils.doAuth(request);
});
beforeEach(function () {
@ -393,14 +387,11 @@ describe('Authentication API v3', function () {
describe('Reset all passwords', function () {
let sendEmail;
before(function () {
return localUtils.startGhost({forceStart: true})
.then(() => {
request = supertest.agent(config.get('url'));
})
.then(() => {
return localUtils.doAuth(request);
});
before(async function () {
const app = await localUtils.startGhost({forceStart: true});
request = supertest.agent(app);
await localUtils.doAuth(request);
});
beforeEach(function () {