A platform for community discussion. Free, open, simple.
DEV: Keep global state reset in a single place (#18049)
Jarek Radosz87f57158786b
diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.jsindex 8caa688682a..2c1ced058a9 100644--- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js@@ -3,7 +3,6 @@ import {count,query,} from "discourse/tests/helpers/qunit-helpers";-import { clearCache } from "discourse/lib/plugin-connectors";import { hbs } from "ember-cli-htmlbars";import { test } from "qunit";import { visit } from "@ember/test-helpers";@@ -14,7 +13,6 @@ const GOODBYE =acceptance("Plugin Outlet - Multi Template", function (needs) {needs.hooks.beforeEach(() => {- clearCache();// eslint-disable-next-line no-undefEmber.TEMPLATES[HELLO] = hbs`<span class='hello-span'>Hello</span>`;// eslint-disable-next-line no-undef@@ -26,7 +24,6 @@ acceptance("Plugin Outlet - Multi Template", function (needs) {delete Ember.TEMPLATES[HELLO];// eslint-disable-next-line no-undefdelete Ember.TEMPLATES[GOODBYE];- clearCache();});test("Renders a template into the outlet", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.jsindex 1d7a2f79b2f..e83b1a05e49 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js@@ -1,6 +1,5 @@import { test } from "qunit";import I18n from "I18n";-import { click, visit } from "@ember/test-helpers";import {acceptance,@@ -9,7 +8,6 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import { withPluginApi } from "discourse/lib/plugin-api";-import { resetSidebarSection } from "discourse/lib/sidebar/user/custom-sections";import { bind } from "discourse-common/utils/decorators";acceptance("Sidebar - Plugin API", function (needs) {@@ -21,7 +19,6 @@ acceptance("Sidebar - Plugin API", function (needs) {});needs.hooks.afterEach(() => {- resetSidebarSection();linkDestroy = undefined;sectionDestroy = undefined;});diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.jsindex 00e8e1916f6..8e62285b85f 100644--- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js+++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js@@ -74,6 +74,7 @@ import { clearExtraHeaderIcons } from "discourse/widgets/header";import { resetSidebarSection } from "discourse/lib/sidebar/user/custom-sections";import { resetNotificationTypeRenderers } from "discourse/lib/notification-types-manager";import { resetUserMenuTabs } from "discourse/lib/user-menu/tab";+import { reset as resetLinkLookup } from "discourse/lib/link-lookup";export function currentUser() {return User.create(sessionFixtures["/session/current.json"].current_user);@@ -204,6 +205,7 @@ export function testCleanup(container, app) {resetNotificationTypeRenderers();clearExtraHeaderIcons();resetUserMenuTabs();+ resetLinkLookup();}export function discourseModule(name, options) {diff --git a/app/assets/javascripts/discourse/tests/unit/lib/link-lookup-test.js b/app/assets/javascripts/discourse/tests/unit/lib/link-lookup-test.jsindex ee3dd69a9c9..99473935751 100644--- a/app/assets/javascripts/discourse/tests/unit/lib/link-lookup-test.js+++ b/app/assets/javascripts/discourse/tests/unit/lib/link-lookup-test.js@@ -1,9 +1,8 @@-import LinkLookup, { reset } from "discourse/lib/link-lookup";+import LinkLookup from "discourse/lib/link-lookup";import { module, test } from "qunit";import Post from "discourse/models/post";module("Unit | Utility | link-lookup", function (hooks) {- hooks.afterEach(() => reset());hooks.beforeEach(function () {this.post = Post.create();this.linkLookup = new LinkLookup({@@ -21,6 +20,7 @@ module("Unit | Utility | link-lookup", function (hooks) {)[0]);});+test("works with http", function (assert) {assert.ok(this.linkLookup.check(@@ -29,6 +29,7 @@ module("Unit | Utility | link-lookup", function (hooks) {)[0]);});+test("works with trailing slash", function (assert) {assert.ok(this.linkLookup.check(@@ -37,6 +38,7 @@ module("Unit | Utility | link-lookup", function (hooks) {)[0]);});+test("works with uppercase characters", function (assert) {assert.ok(this.linkLookup.check(