mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 17:06:01 +08:00
DEV: add acceptance test for topic list
followup on dc14d156 We previously had no tests and no cleanup
This commit is contained in:
21
test/javascripts/acceptance/topic-list-tracker-test.js
Normal file
21
test/javascripts/acceptance/topic-list-tracker-test.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
import {
|
||||||
|
nextTopicUrl,
|
||||||
|
previousTopicUrl,
|
||||||
|
setTopicId
|
||||||
|
} from "discourse/lib/topic-list-tracker";
|
||||||
|
acceptance("Topic list tracking");
|
||||||
|
|
||||||
|
QUnit.test("Navigation", async assert => {
|
||||||
|
await visit("/");
|
||||||
|
let url = await nextTopicUrl();
|
||||||
|
assert.equal(url, "/t/error-after-upgrade-to-0-9-7-9/11557");
|
||||||
|
|
||||||
|
setTopicId(11557);
|
||||||
|
|
||||||
|
url = await nextTopicUrl();
|
||||||
|
assert.equal(url, "/t/welcome-to-meta-discourse-org/1");
|
||||||
|
|
||||||
|
url = await previousTopicUrl();
|
||||||
|
assert.equal(url, "/t/error-after-upgrade-to-0-9-7-9/11557");
|
||||||
|
});
|
@ -27,6 +27,7 @@ import User from "discourse/models/user";
|
|||||||
import { mapRoutes } from "discourse/mapping-router";
|
import { mapRoutes } from "discourse/mapping-router";
|
||||||
import { currentSettings, mergeSettings } from "helpers/site-settings";
|
import { currentSettings, mergeSettings } from "helpers/site-settings";
|
||||||
import { getOwner } from "discourse-common/lib/get-owner";
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
|
import { setTopicList } from "discourse/lib/topic-list-tracker";
|
||||||
|
|
||||||
export function currentUser() {
|
export function currentUser() {
|
||||||
return User.create(sessionFixtures["/session/current.json"].current_user);
|
return User.create(sessionFixtures["/session/current.json"].current_user);
|
||||||
@ -198,6 +199,7 @@ export function acceptance(name, options) {
|
|||||||
resetUsernameDecorators();
|
resetUsernameDecorators();
|
||||||
resetOneboxCache();
|
resetOneboxCache();
|
||||||
resetCustomPostMessageCallbacks();
|
resetCustomPostMessageCallbacks();
|
||||||
|
setTopicList(null);
|
||||||
_clearSnapshots();
|
_clearSnapshots();
|
||||||
Discourse._runInitializer(
|
Discourse._runInitializer(
|
||||||
"instanceInitializers",
|
"instanceInitializers",
|
||||||
|
Reference in New Issue
Block a user