From ddc3c992b7f026d2ef78a50ed992e7a5f71ef750 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 2 Jun 2014 13:35:59 +1000 Subject: [PATCH] Correct unit tests --- app/assets/javascripts/discourse/models/post_stream.js | 1 + test/javascripts/models/post_stream_test.js | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/models/post_stream.js b/app/assets/javascripts/discourse/models/post_stream.js index 8b76ddc0857..0e7e5292385 100644 --- a/app/assets/javascripts/discourse/models/post_stream.js +++ b/app/assets/javascripts/discourse/models/post_stream.js @@ -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); diff --git a/test/javascripts/models/post_stream_test.js b/test/javascripts/models/post_stream_test.js index 36bf4c22dbd..25c0657d5ab 100644 --- a/test/javascripts/models/post_stream_test.js +++ b/test/javascripts/models/post_stream_test.js @@ -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");