DEV: Don't stub `logout` function (#23039)

This commit is contained in:
Jarek Radosz 2023-08-09 18:20:43 +02:00 committed by GitHub
parent ab3a9b4690
commit 993ed10cf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -1,8 +1,13 @@
import getURL from "discourse-common/lib/get-url";
import { helperContext } from "discourse-common/lib/helpers";
import { isEmpty } from "@ember/utils";
import { isTesting } from "discourse-common/config/environment";
export default function logout({ redirect } = {}) {
if (isTesting()) {
return;
}
const ctx = helperContext();
let keyValueStore = ctx.keyValueStore;
keyValueStore.abandonLocal();

View File

@ -1,7 +1,6 @@
import I18n from "I18n";
import EmberObject from "@ember/object";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import sinon from "sinon";
import userFixtures from "discourse/tests/fixtures/user-fixtures";
import {
acceptance,
@ -11,7 +10,6 @@ import {
queryAll,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import * as logout from "discourse/lib/logout";
import { click, currentRouteName, visit } from "@ember/test-helpers";
import { cloneJSON } from "discourse-common/lib/object";
import { test } from "qunit";
@ -363,7 +361,6 @@ acceptance("User - Logout", function (needs) {
needs.user({ username: "eviltrout" });
test("Dialog works", async function (assert) {
sinon.stub(logout, "default");
await visit("/u/eviltrout");
await publishToMessageBus("/logout/19");
@ -379,6 +376,5 @@ acceptance("User - Logout", function (needs) {
);
await click(".dialog-overlay");
assert.ok(logout.default.called, "logout helper was called");
});
});