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

Re-lands #11190
This commit is contained in:
Jarek Radosz 2022-01-17 08:58:37 +01:00 committed by GitHub
parent f0abad6998
commit f2be253b7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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");
});