From eee6519624e6c473991e547f0f716ee3ffa677c8 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 4 Jan 2024 13:19:27 +0000 Subject: [PATCH] test: sort data after getting --- packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts b/packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts index c1536cfa25..db02b20186 100644 --- a/packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts +++ b/packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts @@ -2082,6 +2082,7 @@ function linkBased() { // Links expect(rsp.body.list.length).to.equal(20); + rsp.body.list.sort((a, b) => a.Id - b.Id); for (let i = 1; i <= 20; i++) { expect(rsp.body.list[i - 1]).to.deep.equal({ Id: i, @@ -2098,7 +2099,7 @@ function linkBased() { }, }); expect(rsp.body.list.length).to.equal(1); - expect(rsp.body.list[0]).to.deep.equal({ + expect(rsp.body.list.sort((a, b) => a.Id - b.Id)[0]).to.deep.equal({ Id: 1, Film: `Film 1`, }); @@ -2112,6 +2113,7 @@ function linkBased() { }, }); expect(rsp.body.list.length).to.equal(20); + rsp.body.list.sort((a, b) => a.Id - b.Id); for (let i = 1; i <= 20; i++) { expect(rsp.body.list[i - 1]).to.deep.equal({ Id: i, @@ -2139,6 +2141,7 @@ function linkBased() { }, }); expect(rsp.body.list.length).to.equal(25); + rsp.body.list.sort((a, b) => a.Id - b.Id); // paginated response, limit to 25 for (let i = 1; i <= 25; i++) { expect(rsp.body.list[i - 1]).to.deep.equal({ @@ -2157,6 +2160,7 @@ function linkBased() { }, }); expect(rsp.body.list.length).to.equal(1); + rsp.body.list.sort((a, b) => a.Id - b.Id); expect(rsp.body.list[0]).to.deep.equal({ Id: 1, Actor: `Actor 1`, @@ -2199,6 +2203,7 @@ function linkBased() { }, }); expect(rsp.body.list.length).to.equal(15); + rsp.body.list.sort((a, b) => a.Id - b.Id); for (let i = 2; i <= 30; i += 2) { expect(rsp.body.list[i / 2 - 1]).to.deep.equal({ Id: i, @@ -2217,6 +2222,7 @@ function linkBased() { }); if (i % 2 === 0) { expect(rsp.body.list.length).to.equal(1); + rsp.body.list.sort((a, b) => a.Id - b.Id); expect(rsp.body.list[0]).to.deep.equal({ Id: 1, Actor: `Actor 1`,