Correct unit tests

This commit is contained in:
Sam 2014-06-02 13:35:59 +10:00
parent 7312ee699b
commit ddc3c992b7
2 changed files with 2 additions and 3 deletions

View File

@ -417,6 +417,7 @@ Discourse.PostStream = Em.Object.extend({
}
this.get('stream').removeObject(-1);
this.get('postIdentityMap').set(-1, null);
this.get('postIdentityMap').set(post.get('id'), post);
this.get('stream').addObject(post.get('id'));
this.set('stagingPost', false);

View File

@ -306,10 +306,9 @@ test("staging and undoing a new post", function() {
equal(stagedPost.get('topic'), topic, "it assigns the topic reference");
equal(stagedPost.get('post_number'), 2, "it is assigned the probable post_number");
equal(postStream.get('filteredPostsCount'), 1, "it retains the filteredPostsCount");
present(stagedPost.get('created_at'), "it is assigned a created date");
ok(postStream.get('posts').contains(stagedPost), "the post is added to the stream");
blank(stagedPost.get('id'), "the post has no id yet");
equal(stagedPost.get('id'), -1, "the post has a magical -1 id");
// Undoing a created post (there was an error)
postStream.undoPost(stagedPost);
@ -336,7 +335,6 @@ test("staging and committing a post", function() {
ok(postStream.get('loading'), "it is loading while the post is being staged");
stagedPost.setProperties({ id: 1234, raw: "different raw value" });
equal(postStream.get('filteredPostsCount'), 1, "it retains the filteredPostsCount");
result = postStream.stagePost(stagedPost, user);
equal(result, false, "you can't stage a post while it is currently staging");