Merge pull request #14745 from Budibase/chore/fix-exporting-rows
Fix exporting internal rows
This commit is contained in:
commit
e746506263
|
@ -1846,7 +1846,7 @@ describe.each([
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("exportRows", () => {
|
describe("exportRows", () => {
|
||||||
beforeAll(async () => {
|
beforeEach(async () => {
|
||||||
table = await config.api.table.save(defaultTable())
|
table = await config.api.table.save(defaultTable())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1883,6 +1883,16 @@ describe.each([
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should allow exporting without filtering", async () => {
|
||||||
|
const existing = await config.api.row.save(table._id!, {})
|
||||||
|
const res = await config.api.row.exportRows(table._id!)
|
||||||
|
const results = JSON.parse(res)
|
||||||
|
expect(results.length).toEqual(1)
|
||||||
|
const row = results[0]
|
||||||
|
|
||||||
|
expect(row._id).toEqual(existing._id)
|
||||||
|
})
|
||||||
|
|
||||||
it("should allow exporting only certain columns", async () => {
|
it("should allow exporting only certain columns", async () => {
|
||||||
const existing = await config.api.row.save(table._id!, {})
|
const existing = await config.api.row.save(table._id!, {})
|
||||||
const res = await config.api.row.exportRows(table._id!, {
|
const res = await config.api.row.exportRows(table._id!, {
|
||||||
|
|
|
@ -62,10 +62,10 @@ export async function exportRows(
|
||||||
).rows.map(row => row.doc!)
|
).rows.map(row => row.doc!)
|
||||||
|
|
||||||
result = await outputProcessing(table, response)
|
result = await outputProcessing(table, response)
|
||||||
} else if (query) {
|
} else {
|
||||||
let searchResponse = await sdk.rows.search({
|
let searchResponse = await sdk.rows.search({
|
||||||
tableId,
|
tableId,
|
||||||
query,
|
query: query || {},
|
||||||
sort,
|
sort,
|
||||||
sortOrder,
|
sortOrder,
|
||||||
})
|
})
|
||||||
|
|
|
@ -105,7 +105,7 @@ export class RowAPI extends TestAPI {
|
||||||
|
|
||||||
exportRows = async (
|
exportRows = async (
|
||||||
tableId: string,
|
tableId: string,
|
||||||
body: ExportRowsRequest,
|
body?: ExportRowsRequest,
|
||||||
format: RowExportFormat = RowExportFormat.JSON,
|
format: RowExportFormat = RowExportFormat.JSON,
|
||||||
expectations?: Expectations
|
expectations?: Expectations
|
||||||
) => {
|
) => {
|
||||||
|
|
Loading…
Reference in New Issue