DEV: Prevent potential site state leaks in tests (#18663)
If one were to modify nested objects in `Site.current()` those changes would be carried over subsequent tests.
This commit is contained in:
parent
b6ba106f26
commit
a53eb0882a
|
@ -127,14 +127,14 @@ export function withFrozenTime(timeString, timezone, callback) {
|
|||
|
||||
let _pretenderCallbacks = {};
|
||||
|
||||
export function resetSite(siteSettings, extras) {
|
||||
let siteAttrs = Object.assign(
|
||||
{},
|
||||
siteFixtures["site.json"].site,
|
||||
extras || {}
|
||||
);
|
||||
siteAttrs.siteSettings = siteSettings;
|
||||
PreloadStore.store("site", siteAttrs);
|
||||
export function resetSite(siteSettings, extras = {}) {
|
||||
const siteAttrs = {
|
||||
...siteFixtures["site.json"].site,
|
||||
...extras,
|
||||
siteSettings,
|
||||
};
|
||||
|
||||
PreloadStore.store("site", cloneJSON(siteAttrs));
|
||||
Site.resetCurrent();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue