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!, {
rows: [existing._id!],
})
const results = JSON.parse(res.text)
const results = JSON.parse(res)
expect(results.length).toEqual(1)
const row = results[0]
@ -924,7 +924,7 @@ describe.each([
rows: [existing._id!],
columns: ["_id"],
})
const results = JSON.parse(res.text)
const results = JSON.parse(res)
expect(results.length).toEqual(1)
const row = results[0]

View File

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