Add test for table pagination
This commit is contained in:
parent
125a06517d
commit
3fc6dd62f7
|
@ -37,16 +37,15 @@ export default class RowsApi {
|
|||
return [response, json]
|
||||
}
|
||||
|
||||
async searchSinglePage(tableId: string, body: any): Promise<[Response, Row[]]> {
|
||||
async searchNoPagination(tableId: string, body: any): Promise<[Response, Row[]]> {
|
||||
const response = await this.api.post(`/${tableId}/search`, { body })
|
||||
const json = await response.json()
|
||||
expect(response).toHaveStatusCode(200)
|
||||
expect(json.rows.length).toBeLessThanOrEqual(9)
|
||||
expect(json.hasNextPage).toEqual(false)
|
||||
return [response, json.rows]
|
||||
}
|
||||
|
||||
async searchMultiPage(tableId: string, body: any): Promise<[Response, Row[]]> {
|
||||
async searchWithPagination(tableId: string, body: any): Promise<[Response, Row[]]> {
|
||||
const response = await this.api.post(`/${tableId}/search`, { body })
|
||||
const json = await response.json()
|
||||
expect(response).toHaveStatusCode(200)
|
||||
|
|
|
@ -31,7 +31,7 @@ describe("Internal API - Table Operations", () => {
|
|||
})
|
||||
}
|
||||
|
||||
it("Operations on Tables", async () => {
|
||||
it("Create and delete table, columns and rows", async () => {
|
||||
// create the app
|
||||
const appName = generator.word()
|
||||
const app = await createAppFromTemplate()
|
||||
|
@ -119,7 +119,7 @@ describe("Internal API - Table Operations", () => {
|
|||
await config.rows.add(<string>addColumnData._id, newRow)
|
||||
|
||||
//Search single row
|
||||
await config.rows.searchSinglePage(<string>createdTableData._id, searchBody(<string>createdTableData.primaryDisplay))
|
||||
await config.rows.searchNoPagination(<string>createdTableData._id, searchBody(<string>createdTableData.primaryDisplay))
|
||||
|
||||
//Add 10 more rows
|
||||
for (let i = 0; i < 10; i++) {
|
||||
|
@ -128,7 +128,7 @@ describe("Internal API - Table Operations", () => {
|
|||
}
|
||||
|
||||
//Search rows with pagination
|
||||
const [allRowsResponse, allRowsJson] = await config.rows.searchMultiPage(<string>createdTableData._id, searchBody(<string>createdTableData.primaryDisplay))
|
||||
const [allRowsResponse, allRowsJson] = await config.rows.searchWithPagination(<string>createdTableData._id, searchBody(<string>createdTableData.primaryDisplay))
|
||||
|
||||
//Delete Rows from table
|
||||
const rowToDelete = {
|
||||
|
@ -140,7 +140,7 @@ describe("Internal API - Table Operations", () => {
|
|||
)
|
||||
|
||||
//Search single row
|
||||
await config.rows.searchSinglePage(<string>createdTableData._id, searchBody(<string>createdTableData.primaryDisplay))
|
||||
await config.rows.searchWithPagination(<string>createdTableData._id, searchBody(<string>createdTableData.primaryDisplay))
|
||||
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue