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

Added serializer for email_preview.sendTestEmail

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

- sendTestEmail was missing a serializer because it's deliberately a passthrough
- With the upcoming refactor we want to have all the serializers defined explicitly
- This will allow us to change the default behaviour
- Updated the tests to prove the body doesn't change
This commit is contained in:
Hannah Wolfe 2022-03-17 16:13:25 +00:00
parent 2d7117bddd
commit 7e6a7cb98c
2 changed files with 19 additions and 4 deletions

View file

@ -3,5 +3,8 @@ module.exports = {
frame.response = {
email_previews: [emailPreview]
};
},
sendTestEmail(data, apiConfig, frame) {
frame.response = data;
}
};

View file

@ -142,7 +142,10 @@ describe('Email Preview API', function () {
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200);
.expect(200)
.expect((res) => {
res.body.should.be.empty();
});
});
});
@ -168,7 +171,10 @@ describe('Email Preview API', function () {
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200);
.expect(200)
.expect((res) => {
res.body.should.be.empty();
});
});
});
@ -196,7 +202,10 @@ describe('Email Preview API', function () {
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200);
.expect(200)
.expect((res) => {
res.body.should.be.empty();
});
});
});
@ -224,7 +233,10 @@ describe('Email Preview API', function () {
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(403);
.expect(403)
.expect((res) => {
res.body.should.be.an.Object().with.property('errors');
});
});
});
});