mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added specific newsletters and attribution tests
refs https://github.com/TryGhost/Arch/issues/87 - Round 2 for the previous commit. Removes use of `anyArray` for all - Using `anyArray` in snapshot test is an anti-pattern which leads to leaking output fields unintentionally when the API changes. - Adding these fixes is fundamental work before changing the output of 'member.newsletters' property
This commit is contained in:
parent
4999523289
commit
2e84cdca36
2 changed files with 3748 additions and 128 deletions
File diff suppressed because it is too large
Load diff
|
@ -147,20 +147,29 @@ const memberMatcherShallowIncludes = {
|
||||||
created_at: anyISODateTime,
|
created_at: anyISODateTime,
|
||||||
updated_at: anyISODateTime,
|
updated_at: anyISODateTime,
|
||||||
subscriptions: anyArray,
|
subscriptions: anyArray,
|
||||||
labels: anyArray,
|
labels: anyArray
|
||||||
newsletters: anyArray
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildMemberMatcherShallowIncludesWithTiers = (tiersCount) => {
|
/**
|
||||||
let tiers = anyArray;
|
*
|
||||||
if (tiersCount) {
|
* @param {number} tiersCount
|
||||||
tiers = new Array(tiers).fill(tierMatcher);
|
* @param {number} newsletterCount
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const buildMemberMatcherShallowIncludesWithTiers = (tiersCount, newsletterCount) => {
|
||||||
|
const matcher = {
|
||||||
|
...memberMatcherShallowIncludes
|
||||||
|
};
|
||||||
|
|
||||||
|
if (tiersCount !== undefined) {
|
||||||
|
matcher.tiers = new Array(tiersCount).fill(tierMatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
if (newsletterCount !== undefined) {
|
||||||
...memberMatcherShallowIncludes,
|
matcher.newsletters = new Array(newsletterCount).fill(newsletterSnapshot);
|
||||||
tiers
|
}
|
||||||
};
|
|
||||||
|
return matcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
let agent;
|
let agent;
|
||||||
|
@ -250,7 +259,7 @@ describe('Members API - member attribution', function () {
|
||||||
.get(`/members/${member.id}/`)
|
.get(`/members/${member.id}/`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 2))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -293,7 +302,7 @@ describe('Members API - member attribution', function () {
|
||||||
.get(`/members/${member.id}/`)
|
.get(`/members/${member.id}/`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 2))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -336,7 +345,7 @@ describe('Members API - member attribution', function () {
|
||||||
.get(`/members/${member.id}/`)
|
.get(`/members/${member.id}/`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 2))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -379,7 +388,7 @@ describe('Members API - member attribution', function () {
|
||||||
.get(`/members/${member.id}/`)
|
.get(`/members/${member.id}/`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 2))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -419,7 +428,7 @@ describe('Members API - member attribution', function () {
|
||||||
.get(`/members/${member.id}/`)
|
.get(`/members/${member.id}/`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 2))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -462,7 +471,7 @@ describe('Members API - member attribution', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.only('Members API', function () {
|
describe('Members API', function () {
|
||||||
let newsletters;
|
let newsletters;
|
||||||
let emailMockReceiver;
|
let emailMockReceiver;
|
||||||
|
|
||||||
|
@ -490,7 +499,16 @@ describe.only('Members API', function () {
|
||||||
.get('/members/')
|
.get('/members/')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(8).fill(memberMatcherShallowIncludes)
|
members: [
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 2),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -503,7 +521,7 @@ describe.only('Members API', function () {
|
||||||
.get('/members/?filter=label:label-1')
|
.get('/members/?filter=label:label-1')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(undefined, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -516,7 +534,11 @@ describe.only('Members API', function () {
|
||||||
.get('/members/?filter=signup:' + fixtureManager.get('posts', 0).id)
|
.get('/members/?filter=signup:' + fixtureManager.get('posts', 0).id)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(3).fill(memberMatcherShallowIncludes)
|
members: [
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -529,7 +551,7 @@ describe.only('Members API', function () {
|
||||||
.get('/members/?filter=conversion:' + fixtureManager.get('posts', 0).id)
|
.get('/members/?filter=conversion:' + fixtureManager.get('posts', 0).id)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(undefined, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -542,7 +564,7 @@ describe.only('Members API', function () {
|
||||||
.get('/members/?search=member1')
|
.get('/members/?search=member1')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(undefined, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -555,7 +577,13 @@ describe.only('Members API', function () {
|
||||||
.get('/members/?filter=status:paid')
|
.get('/members/?filter=status:paid')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(5).fill(memberMatcherShallowIncludes)
|
members: [
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 2),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -569,7 +597,12 @@ describe.only('Members API', function () {
|
||||||
.get(`/members/?filter=tier_id:[${products.toJSON().id}]`)
|
.get(`/members/?filter=tier_id:[${products.toJSON().id}]`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(4).fill(memberMatcherShallowIncludes)
|
members: [
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 2),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -582,7 +615,7 @@ describe.only('Members API', function () {
|
||||||
.get(`/members/?filter=name:~'Venkman'`)
|
.get(`/members/?filter=name:~'Venkman'`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(undefined, 0))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -595,7 +628,13 @@ describe.only('Members API', function () {
|
||||||
.get('/members/?filter=status:paid&include=emailRecipients')
|
.get('/members/?filter=status:paid&include=emailRecipients')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(5).fill(memberMatcherShallowIncludes)
|
members: [
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 2),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -613,7 +652,16 @@ describe.only('Members API', function () {
|
||||||
'content-version': anyContentVersion
|
'content-version': anyContentVersion
|
||||||
})
|
})
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(8).fill(memberMatcherShallowIncludes)
|
members: [
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 2),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.expect(({body}) => {
|
.expect(({body}) => {
|
||||||
const {members} = body;
|
const {members} = body;
|
||||||
|
@ -629,7 +677,16 @@ describe.only('Members API', function () {
|
||||||
'content-version': anyContentVersion
|
'content-version': anyContentVersion
|
||||||
})
|
})
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(8).fill(memberMatcherShallowIncludes)
|
members: [
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 2),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 0)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.expect(({body}) => {
|
.expect(({body}) => {
|
||||||
const {members} = body;
|
const {members} = body;
|
||||||
|
@ -642,7 +699,7 @@ describe.only('Members API', function () {
|
||||||
.get('members/?search=egg')
|
.get('members/?search=egg')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: [memberMatcherShallowIncludes]
|
members: [buildMemberMatcherShallowIncludesWithTiers(undefined, 1)]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -655,7 +712,7 @@ describe.only('Members API', function () {
|
||||||
.get('members/?search=MEMBER2')
|
.get('members/?search=MEMBER2')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: [memberMatcherShallowIncludes]
|
members: [buildMemberMatcherShallowIncludesWithTiers(undefined, 1)]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -668,7 +725,7 @@ describe.only('Members API', function () {
|
||||||
.get('members/?search=egon&paid=true')
|
.get('members/?search=egon&paid=true')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: [memberMatcherShallowIncludes]
|
members: [buildMemberMatcherShallowIncludesWithTiers(undefined, 1)]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -696,7 +753,7 @@ describe.only('Members API', function () {
|
||||||
.get(`/members/${testUtils.DataGenerator.Content.members[0].id}/`)
|
.get(`/members/${testUtils.DataGenerator.Content.members[0].id}/`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -709,7 +766,7 @@ describe.only('Members API', function () {
|
||||||
.get(`/members/${testUtils.DataGenerator.Content.members[0].id}/?include=email_recipients`)
|
.get(`/members/${testUtils.DataGenerator.Content.members[0].id}/?include=email_recipients`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -722,7 +779,7 @@ describe.only('Members API', function () {
|
||||||
.get(`/members/${testUtils.DataGenerator.Content.members[0].id}/?include=tiers`)
|
.get(`/members/${testUtils.DataGenerator.Content.members[0].id}/?include=tiers`)
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers())
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -746,7 +803,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [member]})
|
.body({members: [member]})
|
||||||
.expectStatus(201)
|
.expectStatus(201)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 0))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -796,7 +853,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [member]})
|
.body({members: [member]})
|
||||||
.expectStatus(201)
|
.expectStatus(201)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 2))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -818,7 +875,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [memberFailLimit]})
|
.body({members: [memberFailLimit]})
|
||||||
.expectStatus(201)
|
.expectStatus(201)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 2))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -1034,7 +1091,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [initialMember]})
|
.body({members: [initialMember]})
|
||||||
.expectStatus(201)
|
.expectStatus(201)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -1049,7 +1106,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [compedPayload]})
|
.body({members: [compedPayload]})
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(1))
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(1, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -1696,7 +1753,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [memberToChange]})
|
.body({members: [memberToChange]})
|
||||||
.expectStatus(201)
|
.expectStatus(201)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -1728,7 +1785,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [memberChanged]})
|
.body({members: [memberChanged]})
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 0))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -1827,7 +1884,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [memberToChange]})
|
.body({members: [memberToChange]})
|
||||||
.expectStatus(201)
|
.expectStatus(201)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -1860,7 +1917,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [memberChanged]})
|
.body({members: [memberChanged]})
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 1))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -1961,7 +2018,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [memberToCreate]})
|
.body({members: [memberToCreate]})
|
||||||
.expectStatus(201)
|
.expectStatus(201)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 2))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -2056,7 +2113,7 @@ describe.only('Members API', function () {
|
||||||
.body({members: [member]})
|
.body({members: [member]})
|
||||||
.expectStatus(201)
|
.expectStatus(201)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(1).fill(memberMatcherShallowIncludes)
|
members: new Array(1).fill(buildMemberMatcherShallowIncludesWithTiers(0, 2))
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -2263,7 +2320,11 @@ describe.only('Members API', function () {
|
||||||
.get('/members/?filter=newsletters:weekly-newsletter')
|
.get('/members/?filter=newsletters:weekly-newsletter')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(3).fill(memberMatcherShallowIncludes)
|
members: [
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 2),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(undefined, 2)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
@ -2276,7 +2337,16 @@ describe.only('Members API', function () {
|
||||||
.get('/members/?include=tiers&filter=tier:default-product')
|
.get('/members/?include=tiers&filter=tier:default-product')
|
||||||
.expectStatus(200)
|
.expectStatus(200)
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
members: new Array(8).fill(buildMemberMatcherShallowIncludesWithTiers())
|
members: [
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(1, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(1, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(1, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(1, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(1, 1),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(1, 0),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(1, 2),
|
||||||
|
buildMemberMatcherShallowIncludesWithTiers(1, 1)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
'content-version': anyContentVersion,
|
'content-version': anyContentVersion,
|
||||||
|
|
Loading…
Add table
Reference in a new issue