Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sagzy committed Mar 6, 2024
1 parent 283c6b7 commit 40c30e7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
14 changes: 8 additions & 6 deletions ghost/core/test/e2e-api/admin/pages-bulk.test.js
Expand Up @@ -124,10 +124,10 @@ describe('Pages Bulk API', function () {

const products = await models.Product.findAll();

const tier1 = products.models[0];
const tier2 = products.models[1];
const freeTier = products.models[0];
const paidTier = products.models[1];

assert(tier1.id && tier2.id);
assert(freeTier.id && paidTier.id);

// Check all the pages that should be affected
const changedPages = await models.Post.findPage({filter: forcePageFilter(filter), limit: 1, status: 'all'});
Expand All @@ -144,10 +144,12 @@ describe('Pages Bulk API', function () {
visibility: 'tiers',
tiers: [
{
id: tier1.id
id: freeTier.id,
type: freeTier.get('type')
},
{
id: tier2.id
id: paidTier.id,
type: paidTier.get('type')
}
]
}
Expand All @@ -164,7 +166,7 @@ describe('Pages Bulk API', function () {

for (const page of pages) {
assert(page.get('visibility') === 'tiers', `Expect page ${page.id} to have access 'tiers'`);
assert.equal(page.related('tiers').length, 2);
assert.equal(page.related('tiers').length, 1); // Only the paid tier, not the free tier
}
});

Expand Down
14 changes: 8 additions & 6 deletions ghost/core/test/e2e-api/admin/posts-bulk.test.js
Expand Up @@ -159,10 +159,10 @@ describe('Posts Bulk API', function () {

const products = await models.Product.findAll();

const tier1 = products.models[0];
const tier2 = products.models[1];
const freeTier = products.models[0];
const paidTier = products.models[1];

assert(tier1.id && tier2.id);
assert(freeTier.id && paidTier.id);

// Check all the posts that should be affected
const changedPosts = await models.Post.findPage({filter, limit: 1, status: 'all'});
Expand All @@ -179,10 +179,12 @@ describe('Posts Bulk API', function () {
visibility: 'tiers',
tiers: [
{
id: tier1.id
id: freeTier.id,
type: freeTier.get('type')
},
{
id: tier2.id
id: paidTier.id,
type: paidTier.get('type')
}
]
}
Expand All @@ -199,7 +201,7 @@ describe('Posts Bulk API', function () {

for (const post of posts) {
assert(post.get('visibility') === 'tiers', `Expect post ${post.id} to have access 'tiers'`);
assert.equal(post.related('tiers').length, 2);
assert.equal(post.related('tiers').length, 1); // Only the paid tier, not the free tier
}
});

Expand Down
3 changes: 2 additions & 1 deletion ghost/core/test/e2e-api/members-comments/comments.test.js
Expand Up @@ -1026,7 +1026,8 @@ describe('Comments API', function () {
visibility: 'tiers',
tiers: [
{
id: product.id
id: product.id,
type: product.get('type')
}
]
}, {id: post.id});
Expand Down

0 comments on commit 40c30e7

Please sign in to comment.