From 8865b2e8161ce522947d4748d21e5c4e9d9b2edf Mon Sep 17 00:00:00 2001 From: feruzm Date: Mon, 15 Jan 2024 08:42:16 +0530 Subject: [PATCH] update tests --- .../__snapshots__/index.spec.tsx.snap | 8 +- .../comment/__snapshots__/index.spec.tsx.snap | 4 +- .../__snapshots__/index.spec.tsx.snap | 1976 ++++++++ .../__snapshots__/test1.spec.tsx.snap | 4024 ----------------- .../__snapshots__/test2.spec.tsx.snap | 49 - .../__snapshots__/index.spec.tsx.snap | 4 +- .../__snapshots__/index.spec.tsx.snap | 2 +- .../__snapshots__/index.spec.tsx.snap | 6 +- .../__snapshots__/index.spec.tsx.snap | 2 +- .../__snapshots__/index.spec.tsx.snap | 2 +- .../login/__snapshots__/index.spec.tsx.snap | 10 +- .../market-swap-form-header.spec.tsx.snap | 2 +- .../navbar/__snapshots__/index.spec.tsx.snap | 16 +- .../__snapshots__/index.spec.tsx.snap | 2 +- .../__snapshots__/index.spec.tsx.snap | 2 +- .../__snapshots__/index.spec.tsx.snap | 4 +- .../__snapshots__/index.spec.tsx.snap | 4 +- .../__snapshots__/index.spec.tsx.snap | 2 +- .../__snapshots__/index.spec.tsx.snap | 2 +- .../__snapshots__/index.spec.tsx.snap | 2 +- .../sort-discussions.spec.ts.snap | 1657 +++++++ src/common/util/sort-discussions.spec.ts | 10 +- src/common/util/sort-discussions.ts | 8 +- 23 files changed, 3679 insertions(+), 4119 deletions(-) create mode 100644 src/common/components/discussion/__snapshots__/index.spec.tsx.snap delete mode 100644 src/common/components/discussion/__snapshots__/test1.spec.tsx.snap delete mode 100644 src/common/components/discussion/__snapshots__/test2.spec.tsx.snap create mode 100644 src/common/util/__snapshots__/sort-discussions.spec.ts.snap diff --git a/src/common/components/beneficiary-editor/__snapshots__/index.spec.tsx.snap b/src/common/components/beneficiary-editor/__snapshots__/index.spec.tsx.snap index 95805a8d1f8..1879b320f5b 100644 --- a/src/common/components/beneficiary-editor/__snapshots__/index.spec.tsx.snap +++ b/src/common/components/beneficiary-editor/__snapshots__/index.spec.tsx.snap @@ -16,7 +16,7 @@ exports[`(1) Default render 1`] = ` Set Beneficiaries
@@ -552,7 +552,7 @@ exports[`(2) Cancellable, in progress 1`] = `
diff --git a/src/common/components/discussion/__snapshots__/index.spec.tsx.snap b/src/common/components/discussion/__snapshots__/index.spec.tsx.snap new file mode 100644 index 00000000000..1d4d31f174b --- /dev/null +++ b/src/common/components/discussion/__snapshots__/index.spec.tsx.snap @@ -0,0 +1,1976 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Discussions (1) Full render with active user 1`] = ` +
+
+
+ + + +
+
+ 9 Comments +
+ +
+
+`; + +exports[`Discussions (2) Full render with no active user 1`] = ` +
+
+
+ + + + + + 9 Comments +
+ +
+ + Sort Order + + +
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ + behiver + +
+ + + + + +
+
+ + behiver + +
+
+
+ + +
+
Great to see my name on the Giveaway and I like quite much engaging on Discord and find out what others are doing in the HIVE space. A source of news, common hobbies and other topics that rise up your day.

", + } + } + /> +
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ $ 0.08 +
+
+
+ +
+ + + +
+ 2 +
+
+ + Reply + +
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ + irisworld + +
+ + + + + +
+
+ + irisworld + +
+
+
+ + +
+
yahoo! thanks a lot!

", + } + } + /> +
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ $ 0.08 +
+
+
+ +
+ + + +
+ 2 +
+
+ + Reply + +
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ + trincowski + +
+ + + + + +
+
+ + trincowski + +
+
+
+ + +
+
Awesome. Thank you very much.

", + } + } + /> +
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ $ 0.03 +
+
+
+ +
+ + + +
+ 1 +
+
+ + Reply + +
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ + foxkoit + +
+ + + + + +
+
+ + foxkoit + +
+
+
+ + +
+
Thank you 😀😇😇

", + } + } + /> +
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ $ 0.03 +
+
+
+ +
+ + + +
+ 1 +
+
+ + Reply + +
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ + ardpien + +
+ + + + + +
+
+ + ardpien + +
+
+
+ + +
+
😃 I am mentioned here. That's great! All thanks to ESTEEM for creating an awesome Discord server for us to talk in there and participate in activities. Thank You ESTEEM team :) and @good-karma.

", + } + } + /> +
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ $ 0.03 +
+
+
+ +
+ + + +
+ 1 +
+
+ + Reply + +
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ + forykw + +
+ + + + + +
+
+ + forykw + +
+
+
+ + +
+
Prizes have consistently been very effective from @esteemapp nicely done!

", + } + } + /> +
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ $ 0.00 +
+
+
+ +
+ + + +
+ 0 +
+
+ + Reply + +
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ + brittandjosie + +
+ + + + + +
+
+ + brittandjosie + +
+
+
+ + +
+
@ardpien congrats on being one of the winners

", + } + } + /> +
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ $ 0.00 +
+
+
+ +
+ + + +
+ 0 +
+
+ + Reply + +
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ + ardpien + +
+ + + + + +
+
+ + ardpien + +
+
+
+ + +
+
Thank you, Miss. @birttandjosie.

", + } + } + /> +
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ $ 0.00 +
+
+
+ +
+ + + +
+ 0 +
+
+ + Reply + +
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ + iliyan90 + +
+ + + + + +
+
+ + iliyan90 + +
+
+
+ + +
+
@esteemapp
+Bug report click here

", + } + } + /> +
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ $ 0.00 +
+
+
+ +
+ + + +
+ 0 +
+
+ + Reply + +
+
+
+
+
+
+
+`; + +exports[`Discussions (3) With selected item 1`] = ` +
+
+
+ + + +
+
+ 9 Comments +
+ +
+
+`; + +exports[`Discussions (5) Empty list with no active user 1`] = ` +
+
+
+ + + + + + 9 Comments +
+ +
+ + Sort Order + + +
+
+
+`; + +exports[`Discussions (6) Empty list with active user 1`] = ` +
+
+
+ + + +
+
+ 9 Comments +
+ +
+
+`; diff --git a/src/common/components/discussion/__snapshots__/test1.spec.tsx.snap b/src/common/components/discussion/__snapshots__/test1.spec.tsx.snap deleted file mode 100644 index 57fdef0097a..00000000000 --- a/src/common/components/discussion/__snapshots__/test1.spec.tsx.snap +++ /dev/null @@ -1,4024 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`(1) Full render with active user 1`] = ` -
-
-
- - - - - - 9 Comments -
- -
- - Sort Order - - -
-
-
-
-
-
-
-
- -
-
-
-
- - forykw - -
- - - - - -
-
- - forykw - -
-
-
- - - 3 days ago - -
-
Prizes have consistently been very effective from @esteemapp nicely done!

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 0 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - brittandjosie - -
- - - - - -
-
- - brittandjosie - -
-
-
- - - 3 days ago - -
-
@ardpien congrats on being one of the winners

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 0 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - ardpien - -
- - - - - -
-
- - ardpien - -
-
-
- - - 3 days ago - -
-
Thank you, Miss. @birttandjosie.

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 0 -
-
- - Reply - -
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
- - ardpien - -
- - - - - -
-
- - ardpien - -
-
-
- - - 3 days ago - -
-
😃 I am mentioned here. That's great! All thanks to ESTEEM for creating an awesome Discord server for us to talk in there and participate in activities. Thank You ESTEEM team :) and @good-karma.

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.03 -
-
-
- -
- - - -
- 1 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - iliyan90 - -
- - - - - -
-
- - iliyan90 - -
-
-
- - - 3 days ago - -
-
@esteemapp
-Bug report click here

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 0 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - trincowski - -
- - - - - -
-
- - trincowski - -
-
-
- - - 3 days ago - -
-
Awesome. Thank you very much.

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.03 -
-
-
- -
- - - -
- 1 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - foxkoit - -
- - - - - -
-
- - foxkoit - -
-
-
- - - 3 days ago - -
-
Thank you 😀😇😇

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.03 -
-
-
- -
- - - -
- 1 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - irisworld - -
- - - - - -
-
- - irisworld - -
-
-
- - - 3 days ago - -
-
yahoo! thanks a lot!

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.08 -
-
-
- -
- - - -
- 2 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - behiver - -
- - - - - -
-
- - behiver - -
-
-
- - - 3 days ago - -
-
Great to see my name on the Giveaway and I like quite much engaging on Discord and find out what others are doing in the HIVE space. A source of news, common hobbies and other topics that rise up your day.

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.08 -
-
-
- -
- - - -
- 2 -
-
- - Reply - -
-
-
-
-
-
-`; - -exports[`(2) Full render with no active user 1`] = ` -
-
-
- - - -
-
- 9 Comments -
- -
-
-`; - -exports[`(3) With selected item 1`] = ` -
-
-
- - - - - - 9 Comments -
- -
- - Sort Order - - -
-
-
-
-
-
-
-
- -
-
-
-
- - forykw - -
- - - - - -
-
- - forykw - -
-
-
- - - 3 days ago - -
-
Prizes have consistently been very effective from @esteemapp nicely done!

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 0 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - brittandjosie - -
- - - - - -
-
- - brittandjosie - -
-
-
- - - 3 days ago - -
-
@ardpien congrats on being one of the winners

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 0 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - ardpien - -
- - - - - -
-
- - ardpien - -
-
-
- - - 3 days ago - -
-
Thank you, Miss. @birttandjosie.

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 0 -
-
- - Reply - -
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
- - ardpien - -
- - - - - -
-
- - ardpien - -
-
-
- - - 3 days ago - -
-
😃 I am mentioned here. That's great! All thanks to ESTEEM for creating an awesome Discord server for us to talk in there and participate in activities. Thank You ESTEEM team :) and @good-karma.

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.03 -
-
-
- -
- - - -
- 1 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - iliyan90 - -
- - - - - -
-
- - iliyan90 - -
-
-
- - - 3 days ago - -
-
@esteemapp
-Bug report click here

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 0 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - trincowski - -
- - - - - -
-
- - trincowski - -
-
-
- - - 3 days ago - -
-
Awesome. Thank you very much.

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.03 -
-
-
- -
- - - -
- 1 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - foxkoit - -
- - - - - -
-
- - foxkoit - -
-
-
- - - 3 days ago - -
-
Thank you 😀😇😇

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.03 -
-
-
- -
- - - -
- 1 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - irisworld - -
- - - - - -
-
- - irisworld - -
-
-
- - - 3 days ago - -
-
yahoo! thanks a lot!

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.08 -
-
-
- -
- - - -
- 2 -
-
- - Reply - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - behiver - -
- - - - - -
-
- - behiver - -
-
-
- - - 3 days ago - -
-
Great to see my name on the Giveaway and I like quite much engaging on Discord and find out what others are doing in the HIVE space. A source of news, common hobbies and other topics that rise up your day.

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.08 -
-
-
- -
- - - -
- 2 -
-
- - Reply - -
-
-
-
-
-
-`; - -exports[`(4) Show mute button, muted comment 1`] = ` -
-
-
- - - - - - 9 Comments -
- -
- - Sort Order - - -
-
-
-
-
-
-
-
- -
-
-
-
- - forykw - -
- - - - - -
-
- - forykw - -
-
-
- - - 3 days ago - -
-
- - - -
-
Prizes have consistently been very effective from @esteemapp nicely done!

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 180 -
-
- - Reply - - - Unmute - -
-
-
-
-
-
-
-
-
- -
-
-
-
- - brittandjosie - -
- - - - - -
-
- - brittandjosie - -
-
-
- - - 3 days ago - -
-
@ardpien congrats on being one of the winners

", - } - } - /> -
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- $ 0.00 -
-
-
- -
- - - -
- 0 -
-
- - Reply - - - Mute - -
-
-
-
-
-
-`; diff --git a/src/common/components/discussion/__snapshots__/test2.spec.tsx.snap b/src/common/components/discussion/__snapshots__/test2.spec.tsx.snap deleted file mode 100644 index 240c50f38d6..00000000000 --- a/src/common/components/discussion/__snapshots__/test2.spec.tsx.snap +++ /dev/null @@ -1,49 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`(1) Empty list with no active user 1`] = ` -
-
-
- - - -
-
- Join the conversation now -
- -
-
-`; - -exports[`(2) Empty list with active user 1`] = ` -
-`; diff --git a/src/common/components/entry-vote-btn/__snapshots__/index.spec.tsx.snap b/src/common/components/entry-vote-btn/__snapshots__/index.spec.tsx.snap index cce13a2e967..3ad22b6ba7a 100644 --- a/src/common/components/entry-vote-btn/__snapshots__/index.spec.tsx.snap +++ b/src/common/components/entry-vote-btn/__snapshots__/index.spec.tsx.snap @@ -17,7 +17,7 @@ Array [ type="button" >
hivesigner
hivesigner
hivesigner
hivesigner
hivesigner
keychain
`; @@ -404,7 +404,7 @@ exports[`(3) Should show profile edits 1`] = `
hivesigner
hivesigner { const [, ...replies] = discussionInstace1; - sortDiscussions(replies, SortOrder.trending); + sortDiscussions(entryInstance1, replies, SortOrder.trending); expect(replies).toMatchSnapshot(); }); it("(2) Sort author_reputation", () => { const [, ...replies] = discussionInstace1; - sortDiscussions(replies, SortOrder.author_reputation); + sortDiscussions(entryInstance1, replies, SortOrder.author_reputation); expect(replies).toMatchSnapshot(); }); it("(3) Sort author_repuvotestation", () => { const [, ...replies] = discussionInstace1; - sortDiscussions(replies, SortOrder.votes); + sortDiscussions(entryInstance1, replies, SortOrder.votes); expect(replies).toMatchSnapshot(); }); it("(4) Sort created", () => { const [, ...replies] = discussionInstace1; - sortDiscussions(replies, SortOrder.created); + sortDiscussions(entryInstance1, replies, SortOrder.created); expect(replies).toMatchSnapshot(); }); diff --git a/src/common/util/sort-discussions.ts b/src/common/util/sort-discussions.ts index eb2707198bf..cedba7f652c 100644 --- a/src/common/util/sort-discussions.ts +++ b/src/common/util/sort-discussions.ts @@ -21,10 +21,10 @@ export function sortDiscussions(entry: Entry, discussion: Entry[], order: SortOr return -1; } - const apayout = allPayout(a); - const bpayout = allPayout(b); - if (apayout !== bpayout) { - return bpayout - apayout; + const _a = allPayout(a); + const _b = allPayout(b); + if (_a !== _b) { + return _b - _a; } return 0;