0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Tests: Fix one more random failure (#9004)

refs #7470

- this should fix https://github.com/TryGhost/Ghost/issues/7470#issuecomment-321016771
- the importer adds posts in parallel, but the tests read directly from the db without any order
- use findPage (findAll does not support order yet)
This commit is contained in:
Katharina Irrgang 2017-09-12 17:51:40 +02:00 committed by Hannah Wolfe
parent 4237446277
commit aef3d7f3f3

View file

@ -128,7 +128,7 @@ describe('Import', function () {
// Grab the data from tables // Grab the data from tables
return Promise.all([ return Promise.all([
knex('users').select(), knex('users').select(),
knex('posts').select(), models.Post.findPage(testUtils.context.internal),
knex('settings').select(), knex('settings').select(),
knex('tags').select(), knex('tags').select(),
knex('subscribers').select() knex('subscribers').select()
@ -139,7 +139,7 @@ describe('Import', function () {
importedData.length.should.equal(5, 'Did not get data successfully'); importedData.length.should.equal(5, 'Did not get data successfully');
var users = importedData[0], var users = importedData[0],
posts = importedData[1], posts = importedData[1].posts,
settings = importedData[2], settings = importedData[2],
tags = importedData[3], tags = importedData[3],
subscribers = importedData[4]; subscribers = importedData[4];
@ -151,8 +151,8 @@ describe('Import', function () {
// import no longer requires all data to be dropped, and adds posts // import no longer requires all data to be dropped, and adds posts
posts.length.should.equal(exportData.data.posts.length, 'Wrong number of posts'); posts.length.should.equal(exportData.data.posts.length, 'Wrong number of posts');
posts[0].status.should.eql('published'); posts[0].status.should.eql('scheduled');
posts[1].status.should.eql('scheduled'); posts[1].status.should.eql('published');
// test settings // test settings
settings.length.should.be.above(0, 'Wrong number of settings'); settings.length.should.be.above(0, 'Wrong number of settings');