From 62b372ce592691e51aa64dde930beb80b04cbecf Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 20 Jan 2023 10:29:11 +0000 Subject: [PATCH] Fix broken tests --- .../src/tests/utilities/TestConfiguration.ts | 18 +++++++++--------- .../server/src/tests/utilities/structures.ts | 12 +++++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index a0208993e0..25123cac12 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -558,13 +558,11 @@ class TestConfiguration { // DATASOURCE - async createDatasource(config?: Datasource): Promise { + async createDatasource(config?: { + datasource: Datasource + }): Promise { config = config || basicDatasource() - const response = await this._req( - { datasource: config }, - null, - controllers.datasource.save - ) + const response = await this._req(config, null, controllers.datasource.save) this.datasource = response.datasource return this.datasource } @@ -581,9 +579,11 @@ class TestConfiguration { async restDatasource(cfg?: any) { return this.createDatasource({ - ...basicDatasource(), - source: SourceName.REST, - config: cfg || {}, + datasource: { + ...basicDatasource().datasource, + source: SourceName.REST, + config: cfg || {}, + }, }) } diff --git a/packages/server/src/tests/utilities/structures.ts b/packages/server/src/tests/utilities/structures.ts index 2e453e86e5..24ec6eeca6 100644 --- a/packages/server/src/tests/utilities/structures.ts +++ b/packages/server/src/tests/utilities/structures.ts @@ -145,12 +145,14 @@ export function basicRole() { } } -export function basicDatasource(): Datasource { +export function basicDatasource(): { datasource: Datasource } { return { - type: "datasource", - name: "Test", - source: SourceName.POSTGRES, - config: {}, + datasource: { + type: "datasource", + name: "Test", + source: SourceName.POSTGRES, + config: {}, + }, } }