mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 05:05:15 +08:00
DEV: Don't stub logout
function (#23039)
This commit is contained in:
parent
ab3a9b4690
commit
993ed10cf0
|
@ -1,8 +1,13 @@
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import { helperContext } from "discourse-common/lib/helpers";
|
import { helperContext } from "discourse-common/lib/helpers";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
|
import { isTesting } from "discourse-common/config/environment";
|
||||||
|
|
||||||
export default function logout({ redirect } = {}) {
|
export default function logout({ redirect } = {}) {
|
||||||
|
if (isTesting()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const ctx = helperContext();
|
const ctx = helperContext();
|
||||||
let keyValueStore = ctx.keyValueStore;
|
let keyValueStore = ctx.keyValueStore;
|
||||||
keyValueStore.abandonLocal();
|
keyValueStore.abandonLocal();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import sinon from "sinon";
|
|
||||||
import userFixtures from "discourse/tests/fixtures/user-fixtures";
|
import userFixtures from "discourse/tests/fixtures/user-fixtures";
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
@ -11,7 +10,6 @@ import {
|
||||||
queryAll,
|
queryAll,
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import * as logout from "discourse/lib/logout";
|
|
||||||
import { click, currentRouteName, visit } from "@ember/test-helpers";
|
import { click, currentRouteName, visit } from "@ember/test-helpers";
|
||||||
import { cloneJSON } from "discourse-common/lib/object";
|
import { cloneJSON } from "discourse-common/lib/object";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -363,7 +361,6 @@ acceptance("User - Logout", function (needs) {
|
||||||
needs.user({ username: "eviltrout" });
|
needs.user({ username: "eviltrout" });
|
||||||
|
|
||||||
test("Dialog works", async function (assert) {
|
test("Dialog works", async function (assert) {
|
||||||
sinon.stub(logout, "default");
|
|
||||||
await visit("/u/eviltrout");
|
await visit("/u/eviltrout");
|
||||||
await publishToMessageBus("/logout/19");
|
await publishToMessageBus("/logout/19");
|
||||||
|
|
||||||
|
@ -379,6 +376,5 @@ acceptance("User - Logout", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await click(".dialog-overlay");
|
await click(".dialog-overlay");
|
||||||
assert.ok(logout.default.called, "logout helper was called");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user