diff --git a/test/pagination.ts b/test/pagination.ts index 9ec6146..448ecc2 100644 --- a/test/pagination.ts +++ b/test/pagination.ts @@ -91,6 +91,8 @@ describe('TypeORM cursor-based pagination test', () => { expect(firstPageResult.data[1].id).to.not.eq(nextPageResult.data[0].id); expect(firstPageResult.data[1].balance).to.be.above(nextPageResult.data[0].balance); + expect(firstPageResult.data[0].id).to.eq(10); + expect(nextPageResult.data[0].id).to.eq(8); }); it('should return entities with given order', async () => { diff --git a/test/utils/prepareData.ts b/test/utils/prepareData.ts index 4c3081c..2b81dc1 100644 --- a/test/utils/prepareData.ts +++ b/test/utils/prepareData.ts @@ -9,16 +9,12 @@ function setTimestamp(i: number): Date { return now; } -function getRandomFloat(min: number, max: number): number { - const str = (Math.random() * (max - min) + min).toFixed(2); - - return parseFloat(str); -} +const balances = [1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2]; export async function prepareData(): Promise { const data = [...Array(10).keys()].map((i) => ({ name: `user${i}`, - balance: getRandomFloat(1, 2), + balance: balances[i], camelCaseColumn: setTimestamp(i), photos: [ {