Skip to content

Commit 62c937f

Browse files
committed
refactor: remove duplicate query builder in integration test
1 parent 62cecd1 commit 62c937f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/integration.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ describe('TypeORM cursor-based pagination test', () => {
2323

2424
it('should paginate correctly with before and after cursor', async () => {
2525
const queryBuilder = createQueryBuilder();
26-
2726
const firstPagePaginator = buildPaginator({
2827
entity: Example,
2928
query: {
@@ -64,16 +63,14 @@ describe('TypeORM cursor-based pagination test', () => {
6463
});
6564

6665
it('should return entities with given order', async () => {
67-
const ascQueryBuilder = createQueryBuilder();
66+
const queryBuilder = createQueryBuilder();
6867
const ascPaginator = buildPaginator({
6968
entity: Example,
7069
query: {
7170
limit: 1,
7271
order: 'ASC',
7372
},
7473
});
75-
76-
const descQueryBuilder = createQueryBuilder();
7774
const descPaginator = buildPaginator({
7875
entity: Example,
7976
query: {
@@ -82,8 +79,8 @@ describe('TypeORM cursor-based pagination test', () => {
8279
},
8380
});
8481

85-
const ascResult = await ascPaginator.paginate(ascQueryBuilder);
86-
const descResult = await descPaginator.paginate(descQueryBuilder);
82+
const ascResult = await ascPaginator.paginate(queryBuilder.clone());
83+
const descResult = await descPaginator.paginate(queryBuilder.clone());
8784

8885
expect(ascResult.data[0].id).to.eq(1);
8986
expect(descResult.data[0].id).to.eq(10);

0 commit comments

Comments
 (0)