Updating tests to be more consistent in how they pick to create an internal or external table.

This commit is contained in:
mike12345567 2023-10-26 17:27:54 +01:00
parent fd29b8d949
commit d0f989597a
4 changed files with 22 additions and 3 deletions

View File

@ -140,7 +140,12 @@ describe.each([
beforeAll(async () => {
const tableConfig = generateTableConfig()
const table = await config.createTable(tableConfig)
let table
if (dsProvider) {
table = await config.createExternalTable(tableConfig)
} else {
table = await config.createTable(tableConfig)
}
tableId = table._id!
})

View File

@ -58,7 +58,7 @@ describe.each([
},
})
return config.createTable({
return config.createExternalTable({
...priceTable(),
sourceId: datasource._id,
sourceType: TableSourceType.EXTERNAL,

View File

@ -93,7 +93,7 @@ describe.skip("external", () => {
describe("search", () => {
const rows: Row[] = []
beforeAll(async () => {
const table = await config.createTable({
const table = await config.createExternalTable({
...tableData,
sourceId: externalDatasource._id,
})

View File

@ -574,7 +574,21 @@ class TestConfiguration {
config.sourceId = this.datasource._id
config.sourceType = TableSourceType.EXTERNAL
}
return this.updateTable(config, options)
}
async createExternalTable(
config?: TableToBuild,
options = { skipReassigning: false }
) {
if (config != null && config._id) {
delete config._id
}
config = config || basicTable()
if (this.datasource?._id) {
config.sourceId = this.datasource._id
config.sourceType = TableSourceType.EXTERNAL
}
return this.updateTable(config, options)
}