mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 16:33:38 +08:00
DEV: resets user search cache between tests (#13873)
The current behaviour was producing random tests failures which where consistently reproducible using `seed=32037592518471299633729129648744282271` The cause of this error, is a previous test not giving any topicId or categoryId resulting in a cache key "undefined-undefined", just like a possibly previous test. Reseting cache between tests, seems the most straightforward and future proof solution
This commit is contained in:
parent
2818ebd19f
commit
b673fee946
|
@ -12,6 +12,14 @@ let cache = {},
|
||||||
currentTerm,
|
currentTerm,
|
||||||
oldSearch;
|
oldSearch;
|
||||||
|
|
||||||
|
export function resetUserSearchCache() {
|
||||||
|
cache = {};
|
||||||
|
cacheKey = null;
|
||||||
|
cacheTime = null;
|
||||||
|
currentTerm = null;
|
||||||
|
oldSearch = null;
|
||||||
|
}
|
||||||
|
|
||||||
function performSearch(
|
function performSearch(
|
||||||
term,
|
term,
|
||||||
topicId,
|
topicId,
|
||||||
|
|
|
@ -34,6 +34,7 @@ import { resetDecorators as resetPostCookedDecorators } from "discourse/widgets/
|
||||||
import { resetTopicTitleDecorators } from "discourse/components/topic-title";
|
import { resetTopicTitleDecorators } from "discourse/components/topic-title";
|
||||||
import { resetUsernameDecorators } from "discourse/helpers/decorate-username-selector";
|
import { resetUsernameDecorators } from "discourse/helpers/decorate-username-selector";
|
||||||
import { resetWidgetCleanCallbacks } from "discourse/components/mount-widget";
|
import { resetWidgetCleanCallbacks } from "discourse/components/mount-widget";
|
||||||
|
import { resetUserSearchCache } from "discourse/lib/user-search";
|
||||||
import sessionFixtures from "discourse/tests/fixtures/session-fixtures";
|
import sessionFixtures from "discourse/tests/fixtures/session-fixtures";
|
||||||
import { setTopicList } from "discourse/lib/topic-list-tracker";
|
import { setTopicList } from "discourse/lib/topic-list-tracker";
|
||||||
import sinon from "sinon";
|
import sinon from "sinon";
|
||||||
|
@ -272,6 +273,7 @@ export function acceptance(name, optionsOrCallback) {
|
||||||
resetUsernameDecorators();
|
resetUsernameDecorators();
|
||||||
resetOneboxCache();
|
resetOneboxCache();
|
||||||
resetCustomPostMessageCallbacks();
|
resetCustomPostMessageCallbacks();
|
||||||
|
resetUserSearchCache();
|
||||||
clearCustomNavItemHref();
|
clearCustomNavItemHref();
|
||||||
setTopicList(null);
|
setTopicList(null);
|
||||||
_clearSnapshots();
|
_clearSnapshots();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user