Migrate RowAPI.exportRows

This commit is contained in:
Sam Rose 2024-03-01 17:10:49 +00:00
parent 376bb9c105
commit a4e212c0d8
No known key found for this signature in database
2 changed files with 14 additions and 10 deletions

View File

@ -905,7 +905,7 @@ describe.each([
const res = await config.api.row.exportRows(table._id!, { const res = await config.api.row.exportRows(table._id!, {
rows: [existing._id!], rows: [existing._id!],
}) })
const results = JSON.parse(res.text) const results = JSON.parse(res)
expect(results.length).toEqual(1) expect(results.length).toEqual(1)
const row = results[0] const row = results[0]
@ -924,7 +924,7 @@ describe.each([
rows: [existing._id!], rows: [existing._id!],
columns: ["_id"], columns: ["_id"],
}) })
const results = JSON.parse(res.text) const results = JSON.parse(res)
expect(results.length).toEqual(1) expect(results.length).toEqual(1)
const row = results[0] const row = results[0]

View File

@ -11,6 +11,7 @@ import {
DeleteRowRequest, DeleteRowRequest,
DeleteRows, DeleteRows,
DeleteRow, DeleteRow,
ExportRowsResponse,
} from "@budibase/types" } from "@budibase/types"
import { Expectations, TestAPI } from "./base" import { Expectations, TestAPI } from "./base"
@ -105,15 +106,18 @@ export class RowAPI extends TestAPI {
exportRows = async ( exportRows = async (
tableId: string, tableId: string,
body: ExportRowsRequest, body: ExportRowsRequest,
{ expectStatus } = { expectStatus: 200 } expectations?: Expectations
) => { ) => {
const request = this.request const response = await this._requestRaw(
.post(`/api/${tableId}/rows/exportRows?format=json`) "post",
.set(this.config.defaultHeaders()) `/api/${tableId}/rows/exportRows`,
.send(body) {
.expect("Content-Type", /json/) body,
.expect(expectStatus) query: { format: "json" },
return request expectations,
}
)
return response.text
} }
bulkImport = async ( bulkImport = async (