test: update according to minimum limit (#9287)

* test: update according to minimum limit

Signed-off-by: mertmit <mertmit99@gmail.com>

* test: limit & offset verification test

Signed-off-by: mertmit <mertmit99@gmail.com>

---------

Signed-off-by: mertmit <mertmit99@gmail.com>
This commit is contained in:
Mert E.
2024-08-18 18:43:21 +03:00
committed by GitHub
parent 3add153c96
commit 3059f0ba69
3 changed files with 77 additions and 22 deletions

View File

@@ -438,6 +438,8 @@ export interface ColumnType {
ai?: BoolType;
/** Auto Update Timestamp */
au?: BoolType;
/** Column Description */
description?: TextOrNullType;
/**
* Source ID that this column belongs to
* @example ds_krsappzu9f8vmo
@@ -603,6 +605,8 @@ export type ColumnReqType = (
RollupColumnReqType)
) & {
column_name?: string;
/** Model for TextOrNull */
description?: TextOrNullType;
/** Column order in a specific view */
column_order?: {
order?: number;
@@ -2677,6 +2681,8 @@ export interface TableType {
pinned?: BoolType;
/** Unique Base ID */
base_id?: string;
/** Table Description */
description?: TextOrNullType;
/** Table Name. Prefix will be added for XCDB bases. */
table_name: string;
/** Currently not in use */
@@ -2703,6 +2709,8 @@ export interface TableListType {
export interface TableReqType {
/** The column models in this table */
columns: NormalColumnRequestType[];
/** Table description */
description?: TextOrNullType;
/** the meta data for this table */
meta?: MetaType;
/**
@@ -2804,6 +2812,8 @@ export interface ViewType {
meta?: MetaType;
/** The rder of the list of views */
order?: number;
/** View Description */
description?: TextOrNullType;
/** Password for protecting the view */
password?: StringOrNullType;
/** Unique Base ID */
@@ -2871,6 +2881,11 @@ export interface ViewUpdateReqType {
* @example Grid View 1
*/
title?: string;
/**
* Description of the view.
* @example This is a grid view.
*/
description?: TextOrNullType;
/**
* View UUID. Used in Shared View.
* @example e2457bbf-e29c-4fec-866e-fe3b01dba57f
@@ -6165,6 +6180,11 @@ export class Api<
* @example Users
*/
title?: string;
/**
* Table description
* @example Table for storing User Information
*/
description?: TextOrNullType;
/**
* Base ID
* @example p_124hhlkbeasewh

View File

@@ -335,16 +335,16 @@ function generalDb() {
});
it('Nested List - Link to another record', async function () {
const expectedRecords = [1, 3, 1, 2];
const expectedRecords = [1, 3, 1, 2, 1, 13, 1, 1, 3, 2];
// read first 4 records
const records = await ncAxiosGet({
url: `/api/v2/tables/${countryTable.id}/records`,
query: {
limit: 4,
limit: 10,
},
});
expect(records.body.list.length).to.equal(4);
expect(records.body.list.length).to.equal(10);
// extract LTAR column "City List"
const cityList = records.body.list.map((r) => r['Cities']);
@@ -365,16 +365,36 @@ function generalDb() {
['Batna', 'Bchar', 'Skikda'],
['Tafuna'],
['Benguela', 'Namibe'],
['South Hill'],
[
'Almirante Brown',
'Avellaneda',
'Baha Blanca',
'Crdoba',
'Escobar',
'Ezeiza',
'La Plata',
'Merlo',
'Quilmes',
'San Miguel de Tucumn',
'Santa F',
'Tandil',
'Vicente Lpez',
],
['Yerevan'],
['Woodridge'],
['Graz', 'Linz', 'Salzburg'],
['Baku', 'Sumqayit'],
];
// read first 4 records
const records = await ncAxiosGet({
url: `/api/v2/tables/${countryTable.id}/records`,
query: {
limit: 4,
limit: 10,
},
});
expect(records.body.list.length).to.equal(4);
expect(records.body.list.length).to.equal(10);
// extract Lookup column
const lookupData = records.body.list.map((record) => record.Lookup);
@@ -391,16 +411,16 @@ function generalDb() {
rollupFunction: 'count',
});
const expectedRecords = [1, 3, 1, 2];
const expectedRecords = [1, 3, 1, 2, 1, 13, 1, 1, 3, 2];
// read first 4 records
const records = await ncAxiosGet({
url: `/api/v2/tables/${countryTable.id}/records`,
query: {
limit: 4,
limit: 10,
},
});
expect(records.body.list.length).to.equal(4);
expect(records.body.list.length).to.equal(10);
// extract Lookup column
const rollupData = records.body.list.map((record) => record.Rollup);
@@ -1375,13 +1395,13 @@ function numberBased() {
// verify updated records
rsp = await ncAxiosGet({
query: {
limit: 4,
limit: 10,
offset: 400,
fields: 'Id,Number,Decimal,Currency,Percent,Duration,Rating',
},
});
expect(rsp.body.list).to.deep.equal(updatedRecords);
expect(rsp.body.list.slice(0, 4)).to.deep.equal(updatedRecords);
///////////////////////////////////////////////////////////////////////////
@@ -1570,12 +1590,12 @@ function selectBased() {
// verify updated records
rsp = await ncAxiosGet({
query: {
limit: 4,
limit: 10,
offset: 400,
fields: 'Id,SingleSelect,MultiSelect',
},
});
expect(rsp.body.list).to.deep.equal(updatedRecords);
expect(rsp.body.list.slice(0, 4)).to.deep.equal(updatedRecords);
///////////////////////////////////////////////////////////////////////////
@@ -1727,12 +1747,12 @@ function dateBased() {
// verify updated records
rsp = await ncAxiosGet({
query: {
limit: 4,
limit: 10,
offset: 800,
fields: 'Id,Date,DateTime',
},
});
expect(rsp.body.list).to.deep.equal(updatedRecords);
expect(rsp.body.list.slice(0, 4)).to.deep.equal(updatedRecords);
///////////////////////////////////////////////////////////////////////////
@@ -2368,12 +2388,17 @@ function linkBased() {
rowId: 1,
},
query: {
limit: 5,
offset: 10,
limit: 10,
offset: 5,
},
});
expect(rsp.body.list.length).to.equal(5);
expect(rsp.body.list.length).to.equal(10);
expect(rsp.body.list).to.deep.equal([
{ Id: 6, City: 'City 6' },
{ Id: 7, City: 'City 7' },
{ Id: 8, City: 'City 8' },
{ Id: 9, City: 'City 9' },
{ Id: 10, City: 'City 10' },
{ Id: 11, City: 'City 11' },
{ Id: 12, City: 'City 12' },
{ Id: 13, City: 'City 13' },

View File

@@ -80,7 +80,9 @@ test.describe('Fill Handle', () => {
}
// verify api response
const updatedRecords = (await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 4 })).list;
const updatedRecords = (
await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 10 })
).list.slice(0, 4);
for (let i = 0; i < updatedRecords.length; i++) {
for (let j = 0; j < fields.length; j++) {
expect(updatedRecords[i][fields[j].title]).toEqual(fields[j].value);
@@ -141,7 +143,9 @@ test.describe('Fill Handle', () => {
// verify api response
// duration in seconds
const APIResponse = [33, 33.3, 33.3, 33, 60, 3, 2023, '02:02:00'];
const updatedRecords = (await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 4 })).list;
const updatedRecords = (
await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 10 })
).list.slice(0, 4);
for (let i = 0; i < updatedRecords.length; i++) {
for (let j = 0; j < fields.length; j++) {
if (fields[j].title === 'Time') {
@@ -195,7 +199,9 @@ test.describe('Fill Handle', () => {
}
// verify api response
const updatedRecords = (await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 4 })).list;
const updatedRecords = (
await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 10 })
).list.slice(0, 4);
for (let i = 0; i < updatedRecords.length; i++) {
for (let j = 0; j < fields.length; j++) {
expect(updatedRecords[i][fields[j].title]).toContain(fields[j].value);
@@ -248,7 +254,9 @@ test.describe('Fill Handle', () => {
}
// verify api response
const updatedRecords = (await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 4 })).list;
const updatedRecords = (
await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 10 })
).list.slice(0, 4);
for (let i = 0; i < updatedRecords.length; i++) {
for (let j = 0; j < fields.length; j++) {
expect(+updatedRecords[i]['Checkbox']).toBe(1);
@@ -287,7 +295,9 @@ test.describe('Fill Handle', () => {
}
// verify api response
const updatedRecords = (await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 4 })).list;
const updatedRecords = (
await p.api.dbTableRow.list('noco', p.context.base.id, p.table.id, { limit: 10 })
).list.slice(0, 4);
for (let i = 0; i < updatedRecords.length; i++) {
for (let j = 0; j < fields.length; j++) {
expect(updatedRecords[i]['Date']).toBe(fields[j].value);