Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix a computed override in tests (#15596)

Jarek Radoszf2be253b7c88
diff --git a/app/assets/javascripts/discourse/tests/unit/models/topic-test.js b/app/assets/javascripts/discourse/tests/unit/models/topic-test.js
index 2d8676921c5..84e9a3f96c2 100644
--- a/app/assets/javascripts/discourse/tests/unit/models/topic-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/models/topic-test.js
@@ -1,10 +1,10 @@
import Category from "discourse/models/category";
-import EmberObject from "@ember/object";
import Topic from "discourse/models/topic";
import User from "discourse/models/user";
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { IMAGE_VERSION as v } from "pretty-text/emoji/version";
+import createStore from "discourse/tests/helpers/create-store";
discourseModule("Unit | Model | topic", function () {
test("defaults", function (assert) {
@@ -36,7 +36,9 @@ discourseModule("Unit | Model | topic", function () {
});
test("lastUnreadUrl", function (assert) {
- const category = EmberObject.create({
+ const store = createStore();
+ const category = store.createRecord("category", {
+ id: 22,
navigate_to_first_post_after_read: true,
});
@@ -45,10 +47,9 @@ discourseModule("Unit | Model | topic", function () {
highest_post_number: 10,
last_read_post_number: 10,
slug: "hello",
+ category_id: category.id,
});
- topic.set("category", category);
-
assert.strictEqual(topic.get("lastUnreadUrl"), "/t/hello/101/1");
});