0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Cleaned up member's neswletter test suite

refs https://github.com/TryGhost/Arch/issues/87

- We just introduce member's newsletters serialization, so removed the comments reminding to do so.
This commit is contained in:
Naz 2023-09-13 13:06:27 +08:00 committed by naz
parent 282de7f0b4
commit bbb5b64ec5

View file

@ -8,6 +8,7 @@ let membersAgent;
const memberMatcher = (newslettersCount) => {
return {
uuid: anyUuid,
// @NOTE: check if this field is even needed? it differs to the output in the other matcher
created_at: anyISODateTime,
newsletters: new Array(newslettersCount).fill(
{
@ -17,8 +18,7 @@ const memberMatcher = (newslettersCount) => {
};
};
// @todo: we currently don't serialise the output of /api/member/newsletters/, we should fix this
const memberMatcherUnserialised = (newslettersCount) => {
const buildMemberMatcher = (newslettersCount) => {
return {
uuid: anyUuid,
newsletters: new Array(newslettersCount).fill(
@ -66,7 +66,7 @@ describe('Comments API', function () {
.matchHeaderSnapshot({
etag: anyEtag
})
.matchBodySnapshot(memberMatcherUnserialised(1))
.matchBodySnapshot(buildMemberMatcher(1))
.expect(({body}) => {
body.email.should.eql(member.get('email'));
body.enable_comment_notifications.should.eql(false);
@ -186,7 +186,7 @@ describe('Comments API', function () {
.matchHeaderSnapshot({
etag: anyEtag
})
.matchBodySnapshot(memberMatcherUnserialised(2))
.matchBodySnapshot(buildMemberMatcher(2))
.expect(({body}) => {
body.email.should.eql(member.get('email'));
body.enable_comment_notifications.should.eql(true);