Correct unit tests
This commit is contained in:
parent
7312ee699b
commit
ddc3c992b7
|
@ -417,6 +417,7 @@ Discourse.PostStream = Em.Object.extend({
|
||||||
}
|
}
|
||||||
this.get('stream').removeObject(-1);
|
this.get('stream').removeObject(-1);
|
||||||
this.get('postIdentityMap').set(-1, null);
|
this.get('postIdentityMap').set(-1, null);
|
||||||
|
this.get('postIdentityMap').set(post.get('id'), post);
|
||||||
|
|
||||||
this.get('stream').addObject(post.get('id'));
|
this.get('stream').addObject(post.get('id'));
|
||||||
this.set('stagingPost', false);
|
this.set('stagingPost', false);
|
||||||
|
|
|
@ -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('topic'), topic, "it assigns the topic reference");
|
||||||
equal(stagedPost.get('post_number'), 2, "it is assigned the probable post_number");
|
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");
|
present(stagedPost.get('created_at'), "it is assigned a created date");
|
||||||
ok(postStream.get('posts').contains(stagedPost), "the post is added to the stream");
|
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)
|
// Undoing a created post (there was an error)
|
||||||
postStream.undoPost(stagedPost);
|
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");
|
ok(postStream.get('loading'), "it is loading while the post is being staged");
|
||||||
stagedPost.setProperties({ id: 1234, raw: "different raw value" });
|
stagedPost.setProperties({ id: 1234, raw: "different raw value" });
|
||||||
equal(postStream.get('filteredPostsCount'), 1, "it retains the filteredPostsCount");
|
|
||||||
|
|
||||||
result = postStream.stagePost(stagedPost, user);
|
result = postStream.stagePost(stagedPost, user);
|
||||||
equal(result, false, "you can't stage a post while it is currently staging");
|
equal(result, false, "you can't stage a post while it is currently staging");
|
||||||
|
|
Loading…
Reference in New Issue