From 61cf34c09de7d9dc231d6fc72013f5a7b42e08e7 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Tue, 25 May 2021 18:38:41 +0200 Subject: [PATCH] DEV: Don't resetSite() more often than needed (#13138) Avoid calling resetSite() twice per test in certain situations. Included: * DEV: Import `exists` helper --- .../javascripts/discourse/tests/acceptance/group-test.js | 1 + .../discourse/tests/acceptance/topic-edit-timer-test.js | 1 + .../javascripts/discourse/tests/helpers/qunit-helpers.js | 5 +---- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-test.js index 4b400eb7fd1..e1724299041 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-test.js @@ -1,6 +1,7 @@ import { acceptance, count, + exists, queryAll, } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js index 070ee1aaced..0e3a35acb06 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js @@ -1,5 +1,6 @@ import { acceptance, + exists, queryAll, updateCurrentUser, } from "discourse/tests/helpers/qunit-helpers"; diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js index 7a28a0b6845..86ec6c07c01 100644 --- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js +++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js @@ -219,9 +219,7 @@ export function acceptance(name, optionsOrCallback) { clearOutletCache(); clearHTMLCache(); - if (siteChanges) { - resetSite(currentSettings(), siteChanges); - } + resetSite(currentSettings(), siteChanges); if (LEGACY_ENV) { getApplication().__registeredObjects__ = false; @@ -253,7 +251,6 @@ export function acceptance(name, optionsOrCallback) { flushMap(); localStorage.clear(); User.resetCurrent(); - resetSite(currentSettings()); resetExtraClasses(); clearOutletCache(); clearHTMLCache();