diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 0fc9e550e3..284c60f5b1 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -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! }) diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index 2f00a9f172..b03a73ddda 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -58,7 +58,7 @@ describe.each([ }, }) - return config.createTable({ + return config.createExternalTable({ ...priceTable(), sourceId: datasource._id, sourceType: TableSourceType.EXTERNAL, diff --git a/packages/server/src/sdk/app/rows/search/tests/external.spec.ts b/packages/server/src/sdk/app/rows/search/tests/external.spec.ts index d0f59cdd83..c92155230a 100644 --- a/packages/server/src/sdk/app/rows/search/tests/external.spec.ts +++ b/packages/server/src/sdk/app/rows/search/tests/external.spec.ts @@ -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, }) diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index 0c81ba4123..5b23c5c353 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -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) }