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:
Alan Guo Xiang Tan 2022-11-02 19:07:17 +08:00 committed by GitHub
parent e6856a3ca3
commit 46e9f402eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -127,11 +127,10 @@ export function withFrozenTime(timeString, timezone, callback) {
let _pretenderCallbacks = {};
export function resetSite(siteSettings, extras = {}) {
export function resetSite(extras = {}) {
const siteAttrs = {
...siteFixtures["site.json"].site,
...extras,
siteSettings,
};
PreloadStore.store("site", cloneJSON(siteAttrs));
@ -311,9 +310,10 @@ export function acceptance(name, optionsOrCallback) {
if (settingChanges) {
mergeSettings(settingChanges);
}
this.siteSettings = currentSettings();
resetSite(currentSettings(), siteChanges);
resetSite(siteChanges);
this.container = getOwner(this);

View File

@ -313,7 +313,7 @@ export default function setupTests(config) {
});
PreloadStore.reset();
resetSite(settings);
resetSite();
sinon.stub(ScrollingDOMMethods, "screenNotFull");
sinon.stub(ScrollingDOMMethods, "bindOnScroll");