DEV: Use cloneJSON instead of spread operator (#16615)

Spread does shallow clone, so changes in these tests leak.
This commit is contained in:
Jarek Radosz 2022-05-04 08:11:45 +02:00 committed by GitHub
parent 79c854d9be
commit 73940fa968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import I18n from "I18n";
import { test } from "qunit";
import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";
import sinon from "sinon";
import { cloneJSON } from "discourse-common/lib/object";
acceptance(
"Local Dates - Download calendar without default calendar option set",
@ -15,7 +16,7 @@ acceptance(
needs.user({ default_calendar: "none_selected" });
needs.settings({ discourse_local_dates_enabled: true });
needs.pretender((server, helper) => {
const response = { ...fixturesByUrl["/t/281.json"] };
const response = cloneJSON(fixturesByUrl["/t/281.json"]);
const startDate = moment
.tz("Africa/Cairo")
.add(1, "days")
@ -45,7 +46,7 @@ acceptance(
needs.user({ default_calendar: "none_selected" });
needs.settings({ discourse_local_dates_enabled: true });
needs.pretender((server, helper) => {
const response = { ...fixturesByUrl["/t/281.json"] };
const response = cloneJSON(fixturesByUrl["/t/281.json"]);
const startDate = moment
.tz("Africa/Cairo")
.subtract(1, "days")
@ -71,7 +72,7 @@ acceptance(
needs.user({ default_calendar: "google" });
needs.settings({ discourse_local_dates_enabled: true });
needs.pretender((server, helper) => {
const response = { ...fixturesByUrl["/t/281.json"] };
const response = cloneJSON(fixturesByUrl["/t/281.json"]);
const startDate = moment
.tz("Africa/Cairo")
.add(1, "days")