Skip to content

Commit

Permalink
tests: fix order by removing manual reversal, part of API now
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Jul 31, 2024
1 parent cfbbe2f commit 54f17d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
14 changes: 7 additions & 7 deletions packages/tests/tests/store/cursor.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("Waku Store, cursor", function () {
// messages in reversed order (first message at last index)
const messages: DecodedMessage[] = [];
for await (const page of waku.store.queryGenerator([TestDecoder])) {
for await (const msg of page.reverse()) {
for await (const msg of page) {
messages.push(msg as DecodedMessage);
}
}
Expand All @@ -65,7 +65,7 @@ describe("Waku Store, cursor", function () {
for await (const page of waku.store.queryGenerator([TestDecoder], {
paginationCursor: cursor
})) {
for await (const msg of page.reverse()) {
for await (const msg of page) {
if (msg) {
messagesAfterCursor.push(msg as DecodedMessage);
}
Expand Down Expand Up @@ -102,7 +102,7 @@ describe("Waku Store, cursor", function () {
// messages in reversed order (first message at last index)
const messages: DecodedMessage[] = [];
for await (const page of waku.store.queryGenerator([TestDecoder])) {
for await (const msg of page.reverse()) {
for await (const msg of page) {
messages.push(msg as DecodedMessage);
}
}
Expand All @@ -115,7 +115,7 @@ describe("Waku Store, cursor", function () {
for await (const page of waku2.store.queryGenerator([TestDecoder], {
paginationCursor: cursor
})) {
for await (const msg of page.reverse()) {
for await (const msg of page) {
if (msg) {
messagesAfterCursor.push(msg as DecodedMessage);
}
Expand All @@ -142,7 +142,7 @@ describe("Waku Store, cursor", function () {

const messages: DecodedMessage[] = [];
for await (const page of waku.store.queryGenerator([TestDecoder])) {
for await (const msg of page.reverse()) {
for await (const msg of page) {
messages.push(msg as DecodedMessage);
}
}
Expand All @@ -155,7 +155,7 @@ describe("Waku Store, cursor", function () {
for await (const page of waku.store.queryGenerator([TestDecoder], {
paginationCursor: cursor
})) {
for await (const msg of page.reverse()) {
for await (const msg of page) {
if (msg) {
messagesAfterCursor.push(msg as DecodedMessage);
}
Expand Down Expand Up @@ -186,7 +186,7 @@ describe("Waku Store, cursor", function () {

const messages: DecodedMessage[] = [];
for await (const page of waku.store.queryGenerator([TestDecoder])) {
for await (const msg of page.reverse()) {
for await (const msg of page) {
messages.push(msg as DecodedMessage);
}
}
Expand Down
3 changes: 0 additions & 3 deletions packages/tests/tests/store/order.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ describe("Waku Store, order", function () {
}
);

if (pageDirection === false) {
messages.reverse();
}
expect(messages?.length).eq(totalMsgs);
const payloads = messages.map((msg) => msg.payload[0]!);
expect(payloads).to.deep.eq(Array.from(Array(totalMsgs).keys()));
Expand Down

0 comments on commit 54f17d0

Please sign in to comment.