0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00

Merge pull request #4796 from jaswilli/import-test-fix

Don't assume order of results in import test
This commit is contained in:
Hannah Wolfe 2015-01-13 17:31:18 +00:00
commit b4e2484f6e

View file

@ -609,22 +609,26 @@ describe('Importer', function () {
// deleted-2014-12-19-test-1.md
// doesn't get imported ;)
// loadFile doesn't guarantee order of results
var one = result.data.posts[0].status === 'published' ? 0 : 1,
two = one === 0 ? 1 : 0;
// published-2014-12-19-test-1.md
result.data.posts[0].markdown.should.eql('You\'re live! Nice.');
result.data.posts[0].status.should.eql('published');
result.data.posts[0].slug.should.eql('test-1');
result.data.posts[0].title.should.eql('Welcome to Ghost');
result.data.posts[0].published_at.should.eql(1418990400000);
moment(result.data.posts[0].published_at).format('DD MM YY HH:mm').should.eql('19 12 14 12:00');
result.data.posts[0].should.not.have.property('image');
result.data.posts[one].markdown.should.eql('You\'re live! Nice.');
result.data.posts[one].status.should.eql('published');
result.data.posts[one].slug.should.eql('test-1');
result.data.posts[one].title.should.eql('Welcome to Ghost');
result.data.posts[one].published_at.should.eql(1418990400000);
moment(result.data.posts[one].published_at).format('DD MM YY HH:mm').should.eql('19 12 14 12:00');
result.data.posts[one].should.not.have.property('image');
// draft-2014-12-19-test-3.md
result.data.posts[1].markdown.should.eql('You\'re live! Nice.');
result.data.posts[1].status.should.eql('draft');
result.data.posts[1].slug.should.eql('test-3');
result.data.posts[1].title.should.eql('Welcome to Ghost');
result.data.posts[1].created_at.should.eql(1418990400000);
result.data.posts[1].image.should.eql('/images/kitten.jpg');
result.data.posts[two].markdown.should.eql('You\'re live! Nice.');
result.data.posts[two].status.should.eql('draft');
result.data.posts[two].slug.should.eql('test-3');
result.data.posts[two].title.should.eql('Welcome to Ghost');
result.data.posts[two].created_at.should.eql(1418990400000);
result.data.posts[two].image.should.eql('/images/kitten.jpg');
done();
}).catch(done);