Move TopicTrackingState to injected object

This commit is contained in:
Robin Ward
2015-09-03 16:55:55 -04:00
parent 064b62199e
commit 8e776d0fd7
33 changed files with 256 additions and 263 deletions

View File

@ -1,21 +1,19 @@
module("Discourse.TopicTrackingState");
import TopicTrackingState from 'discourse/models/topic-tracking-state';
test("sync", function () {
module("model:topic-tracking-state");
var state = Discourse.TopicTrackingState.create();
// fake track it
test("sync", function (assert) {
const state = TopicTrackingState.create();
state.states["t111"] = {last_read_post_number: null};
state.updateSeen(111, 7);
var list = {topics: [{
const list = {topics: [{
highest_post_number: null,
id: 111,
unread: 10,
new_posts: 10
}]};
}]};
state.sync(list, "new");
equal(list.topics.length, 0, "expect new topic to be removed as it was seen");
assert.equal(list.topics.length, 0, "expect new topic to be removed as it was seen");
});