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

Fixed regression tests

no issue

- Descreased ammount of posts inserted by 'posts:mu' fixture so that Travis doesn't timeout.
- The fix is just a patch, needs investigation into what change caused the timeout in the first place
This commit is contained in:
Nazar Gargol 2019-03-11 12:23:20 +08:00
parent 49cf18fe33
commit 659c63c98a
2 changed files with 11 additions and 9 deletions

View file

@ -1836,16 +1836,18 @@ describe('Post Model', function () {
var authorData = {id: testUtils.DataGenerator.Content.users[0].id};
models.Post.findAll({context: {internal: true}}).then(function (found) {
// There are 50 posts to begin with
found.length.should.equal(50);
// There are 25 posts created by posts:mu fixture
found.length.should.equal(25);
return models.Post.destroyByAuthor(authorData);
}).then(function (results) {
// User 1 has 10 posts in the database
results.length.should.equal(10);
// User 1 has 5 posts in the database (each user has proportionate amount)
// 5 = 25 / 5 (posts / users)
results.length.should.equal(5);
return models.Post.findAll({context: {internal: true}});
}).then(function (found) {
// Only 40 should remain
found.length.should.equal(40);
// Only 20 should remain
// 20 = 25 - 5
found.length.should.equal(20);
done();
}).catch(done);
});

View file

@ -88,11 +88,11 @@ fixtures = {
});
},
insertMultiAuthorPosts: function insertMultiAuthorPosts(max) {
insertMultiAuthorPosts: function insertMultiAuthorPosts() {
let i, j, k = 0,
posts = [];
max = max || 50;
const count = 25;
// insert users of different roles
return Promise.resolve(fixtures.createUsersWithRoles()).then(function () {
@ -114,7 +114,7 @@ fixtures = {
users = _.map(users, 'id');
// Let's insert posts with random authors
for (i = 0; i < max; i += 1) {
for (i = 0; i < count; i += 1) {
const author = users[i % users.length];
posts.push(DataGenerator.forKnex.createGenericPost(k, null, null, author));
k = k + 1;