From 659c63c98ab9a29c09209cb1ae2e05a18362cb66 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Mon, 11 Mar 2019 12:23:20 +0800 Subject: [PATCH] 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 --- core/test/regression/models/model_posts_spec.js | 14 ++++++++------ core/test/utils/index.js | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/test/regression/models/model_posts_spec.js b/core/test/regression/models/model_posts_spec.js index 529893183e..0b18e71a11 100644 --- a/core/test/regression/models/model_posts_spec.js +++ b/core/test/regression/models/model_posts_spec.js @@ -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); }); diff --git a/core/test/utils/index.js b/core/test/utils/index.js index 1fe56b6cc7..2066e44629 100644 --- a/core/test/utils/index.js +++ b/core/test/utils/index.js @@ -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;