Use api calls for createExternalTable test helper

This commit is contained in:
Adria Navarro 2024-01-26 10:52:35 +01:00
parent 0efe0bb7ac
commit a555734519
1 changed files with 11 additions and 2 deletions

View File

@ -618,7 +618,7 @@ class TestConfiguration {
async createExternalTable(
config?: TableToBuild,
options = { skipReassigning: false }
) {
): Promise<Table> {
if (config != null && config._id) {
delete config._id
}
@ -627,7 +627,16 @@ class TestConfiguration {
config.sourceId = this.datasource._id
config.sourceType = TableSourceType.EXTERNAL
}
return this.updateTable(config, options)
const table = await this.api.table.create({
...config,
sourceType: config.sourceType || TableSourceType.INTERNAL,
sourceId: config.sourceId || INTERNAL_TABLE_SOURCE_ID,
})
if (!options.skipReassigning) {
this.table = table
}
return table
}
async getTable(tableId?: string) {