Skip to content
This repository has been archived by the owner on Dec 2, 2018. It is now read-only.

Commit

Permalink
Merge pull request TryGhost#4796 from jaswilli/import-test-fix
Browse files Browse the repository at this point in the history
Don't assume order of results in import test
  • Loading branch information
ErisDS committed Jan 13, 2015
2 parents 2debe1c + 9151f53 commit b4e2484
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions core/test/unit/importer_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b4e2484

Please sign in to comment.