REFACTOR: Remove _.clone which is not deep

This commit is contained in:
Robin Ward 2020-09-01 16:42:22 -04:00
parent c2cfa62000
commit 2d56663fc4
3 changed files with 8 additions and 5 deletions

View File

@ -211,7 +211,7 @@ createWidget("discourse-poll-standard-results", {
const voters = poll.get("voters");
const isPublic = poll.get("public");
const ordered = _.clone(options).sort((a, b) => {
const ordered = [...options].sort((a, b) => {
if (a.votes < b.votes) {
return 1;
} else if (a.votes === b.votes) {

View File

@ -22,7 +22,10 @@ test("listing user bookmarks", async assert => {
});
test("removing a bookmark with a reminder shows a confirmation", async assert => {
let listResponse = _.clone(userFixtures["/u/eviltrout/bookmarks.json"]);
let listResponse = Object.assign(
{},
userFixtures["/u/eviltrout/bookmarks.json"]
);
listResponse.user_bookmark_list.bookmarks[0].reminder_at = "2028-01-01T08:00";
pretender.get("/u/eviltrout/bookmarks.json", () => [
200,

View File

@ -12,7 +12,7 @@ acceptance("User Card - Show Local Time", {
QUnit.skip("user card local time", async assert => {
User.current().changeTimezone("Australia/Brisbane");
let cardResponse = _.clone(userFixtures["/u/eviltrout/card.json"]);
let cardResponse = Object.assign({}, userFixtures["/u/eviltrout/card.json"]);
cardResponse.user.timezone = "Australia/Perth";
pretender.get("/u/eviltrout/card.json", () => [
@ -39,7 +39,7 @@ QUnit.skip("user card local time", async assert => {
"user card contains the user's local time"
);
cardResponse = _.clone(userFixtures["/u/charlie/card.json"]);
cardResponse = Object.assign({}, userFixtures["/u/charlie/card.json"]);
cardResponse.user.timezone = "America/New_York";
pretender.get("/u/charlie/card.json", () => [
@ -68,7 +68,7 @@ QUnit.test(
"user card local time - does not update timezone for another user",
async assert => {
User.current().changeTimezone("Australia/Brisbane");
let cardResponse = _.clone(userFixtures["/u/charlie/card.json"]);
let cardResponse = Object.assign({}, userFixtures["/u/charlie/card.json"]);
delete cardResponse.user.timezone;
pretender.get("/u/charlie/card.json", () => [