mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 20:08:26 +00:00
DEV: Avoid cloning site settings in QUnit tests (#18811)
`siteSettings` is now a service which means there should only be one state for `siteSettings` during the life time of the application. This also helps to maintain parity with production where the `site` model relies on the `siteSettings` service and not a clone of the attributes.
This commit is contained in:
parent
e6856a3ca3
commit
46e9f402eb
@ -127,11 +127,10 @@ export function withFrozenTime(timeString, timezone, callback) {
|
|||||||
|
|
||||||
let _pretenderCallbacks = {};
|
let _pretenderCallbacks = {};
|
||||||
|
|
||||||
export function resetSite(siteSettings, extras = {}) {
|
export function resetSite(extras = {}) {
|
||||||
const siteAttrs = {
|
const siteAttrs = {
|
||||||
...siteFixtures["site.json"].site,
|
...siteFixtures["site.json"].site,
|
||||||
...extras,
|
...extras,
|
||||||
siteSettings,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PreloadStore.store("site", cloneJSON(siteAttrs));
|
PreloadStore.store("site", cloneJSON(siteAttrs));
|
||||||
@ -311,9 +310,10 @@ export function acceptance(name, optionsOrCallback) {
|
|||||||
if (settingChanges) {
|
if (settingChanges) {
|
||||||
mergeSettings(settingChanges);
|
mergeSettings(settingChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.siteSettings = currentSettings();
|
this.siteSettings = currentSettings();
|
||||||
|
|
||||||
resetSite(currentSettings(), siteChanges);
|
resetSite(siteChanges);
|
||||||
|
|
||||||
this.container = getOwner(this);
|
this.container = getOwner(this);
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ export default function setupTests(config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PreloadStore.reset();
|
PreloadStore.reset();
|
||||||
resetSite(settings);
|
resetSite();
|
||||||
|
|
||||||
sinon.stub(ScrollingDOMMethods, "screenNotFull");
|
sinon.stub(ScrollingDOMMethods, "screenNotFull");
|
||||||
sinon.stub(ScrollingDOMMethods, "bindOnScroll");
|
sinon.stub(ScrollingDOMMethods, "bindOnScroll");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user