DEV: Clear `NavItem.customNavItemHrefs` between tests (#13025)

DEV: Clear NavItem.customNavItemHrefs between tests (#13025)

Identical callbacks can pile up during tests and cause all sort of weird problems that are difficult to debug. This commit clears registered callbacks after each test.

diff --git a/app/assets/javascripts/discourse/app/models/nav-item.js b/app/assets/javascripts/discourse/app/models/nav-item.js
index d369d05..0293fbd 100644
--- a/app/assets/javascripts/discourse/app/models/nav-item.js
+++ b/app/assets/javascripts/discourse/app/models/nav-item.js
@@ -301,6 +301,10 @@ export function customNavItemHref(cb) {
   NavItem.customNavItemHrefs.push(cb);
 }
 
+export function clearCustomNavItemHref() {
+  NavItem.customNavItemHrefs.clear();
+}
+
 export function addNavItem(item) {
   NavItem.extraNavItemDescriptors.push(item);
 }
diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
index 8d0d251..826b5f2 100644
--- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
+++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
@@ -39,6 +39,7 @@ import { setTopicList } from "discourse/lib/topic-list-tracker";
 import sinon from "sinon";
 import siteFixtures from "discourse/tests/fixtures/site-fixtures";
 import { clearResolverOptions } from "discourse-common/resolver";
+import { clearCustomNavItemHref } from "discourse/models/nav-item";
 
 const LEGACY_ENV = !setupApplicationTest;
 
@@ -260,6 +261,7 @@ export function acceptance(name, optionsOrCallback) {
       resetUsernameDecorators();
       resetOneboxCache();
       resetCustomPostMessageCallbacks();
+      clearCustomNavItemHref();
       setTopicList(null);
       _clearSnapshots();
       setURLContainer(null);

GitHub sha: 9ec5f397

This commit appears in #13025 which was approved by CvX. It was merged by OsamaSayegh.