🐛Fixed pagination for PostgreSQL connector
This commit is contained in:
committed by
Anton Shepilov
parent
845781642f
commit
585da88b0d
+23
@@ -7,6 +7,7 @@ import {
|
||||
} from "../../../../../../../../../src/core/platform/services/database/services/orm/connectors/postgres/postgres";
|
||||
import { getEntityDefinition } from '../../../../../../../../../src/core/platform/services/database/services/orm/utils';
|
||||
import { TestDbEntity, normalizeWhitespace, newTestDbEntity } from "./utils";
|
||||
import { Pagination } from "../../../../../../../../../src/core/platform/framework/api/crud-service";
|
||||
|
||||
describe('The Postgres Connector module', () => {
|
||||
|
||||
@@ -28,6 +29,28 @@ describe('The Postgres Connector module', () => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test('nextPage successfully iterate starting from null value', () => {
|
||||
//given
|
||||
const pagination = new Pagination(null, "5");
|
||||
|
||||
//when
|
||||
let nextPage = subj.nextPage(pagination, 5);
|
||||
|
||||
//then
|
||||
expect(nextPage.page_token).toEqual("1")
|
||||
expect(nextPage.limitStr).toEqual("5");
|
||||
|
||||
nextPage = subj.nextPage(Pagination.fromPaginable(nextPage), 5);
|
||||
//then
|
||||
expect(nextPage.page_token).toEqual("2")
|
||||
expect(nextPage.limitStr).toEqual("5");
|
||||
|
||||
nextPage = subj.nextPage(Pagination.fromPaginable(nextPage), 1);
|
||||
//then
|
||||
expect(nextPage.page_token).toEqual(false)
|
||||
expect(nextPage.limitStr).toEqual("5");
|
||||
})
|
||||
|
||||
test('createTable generates table structure queries', async () => {
|
||||
// given
|
||||
const definition = getEntityDefinition(new TestDbEntity());
|
||||
|
||||
Reference in New Issue
Block a user