REFACTOR: Remove `_.clone` which is not deep
This commit is contained in:
parent
c2cfa62000
commit
2d56663fc4
|
@ -211,7 +211,7 @@ createWidget("discourse-poll-standard-results", {
|
||||||
const voters = poll.get("voters");
|
const voters = poll.get("voters");
|
||||||
const isPublic = poll.get("public");
|
const isPublic = poll.get("public");
|
||||||
|
|
||||||
const ordered = _.clone(options).sort((a, b) => {
|
const ordered = [...options].sort((a, b) => {
|
||||||
if (a.votes < b.votes) {
|
if (a.votes < b.votes) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (a.votes === b.votes) {
|
} else if (a.votes === b.votes) {
|
||||||
|
|
|
@ -22,7 +22,10 @@ test("listing user bookmarks", async assert => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("removing a bookmark with a reminder shows a confirmation", 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";
|
listResponse.user_bookmark_list.bookmarks[0].reminder_at = "2028-01-01T08:00";
|
||||||
pretender.get("/u/eviltrout/bookmarks.json", () => [
|
pretender.get("/u/eviltrout/bookmarks.json", () => [
|
||||||
200,
|
200,
|
||||||
|
|
|
@ -12,7 +12,7 @@ acceptance("User Card - Show Local Time", {
|
||||||
|
|
||||||
QUnit.skip("user card local time", async assert => {
|
QUnit.skip("user card local time", async assert => {
|
||||||
User.current().changeTimezone("Australia/Brisbane");
|
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";
|
cardResponse.user.timezone = "Australia/Perth";
|
||||||
|
|
||||||
pretender.get("/u/eviltrout/card.json", () => [
|
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"
|
"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";
|
cardResponse.user.timezone = "America/New_York";
|
||||||
|
|
||||||
pretender.get("/u/charlie/card.json", () => [
|
pretender.get("/u/charlie/card.json", () => [
|
||||||
|
@ -68,7 +68,7 @@ QUnit.test(
|
||||||
"user card local time - does not update timezone for another user",
|
"user card local time - does not update timezone for another user",
|
||||||
async assert => {
|
async assert => {
|
||||||
User.current().changeTimezone("Australia/Brisbane");
|
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;
|
delete cardResponse.user.timezone;
|
||||||
|
|
||||||
pretender.get("/u/charlie/card.json", () => [
|
pretender.get("/u/charlie/card.json", () => [
|
||||||
|
|
Loading…
Reference in New Issue