Fix tests

This commit is contained in:
Adria Navarro 2023-11-20 13:52:41 +01:00
parent 0a289f508e
commit b121d64b79
1 changed files with 35 additions and 23 deletions

View File

@ -16,7 +16,20 @@ describe("datasourceUtils", () => {
const internalTables = { const internalTables = {
_id: "datasource_internal_bb_default", _id: "datasource_internal_bb_default",
name: "Sample Data", name: "Sample Data",
entities: [ }
const pgDatasource = {
_id: "pg_ds",
name: "PostgreSQL local",
}
const mysqlDatasource = {
_id: "mysql_ds",
name: "My SQL local",
}
const tables = [
...[
{ {
_id: "ta_bb_employee", _id: "ta_bb_employee",
name: "Employees", name: "Employees",
@ -37,14 +50,12 @@ describe("datasourceUtils", () => {
_id: "ta_bb_jobs", _id: "ta_bb_jobs",
name: "Jobs", name: "Jobs",
}, },
], ].map(t => ({
} ...t,
sourceId: internalTables._id,
const pgDatasource = { })),
_id: "pg_ds", ...[
name: "PostgreSQL local", {
entities: {
"External Inventory": {
_id: "pg_ds-external_inventory", _id: "pg_ds-external_inventory",
name: "External Inventory", name: "External Inventory",
views: { views: {
@ -58,7 +69,7 @@ describe("datasourceUtils", () => {
}, },
}, },
}, },
"Another table": { {
_id: "pg_ds-another_table", _id: "pg_ds-another_table",
name: "Another table", name: "Another table",
views: { views: {
@ -72,7 +83,7 @@ describe("datasourceUtils", () => {
}, },
}, },
}, },
table2: { {
_id: "pg_ds_table2", _id: "pg_ds_table2",
name: "table2", name: "table2",
views: { views: {
@ -86,19 +97,20 @@ describe("datasourceUtils", () => {
}, },
}, },
}, },
}, ].map(t => ({
} ...t,
sourceId: pgDatasource._id,
const mysqlDatasource = { })),
_id: "mysql_ds", ...[
name: "My SQL local", {
entities: {
"MySQL table": {
_id: "mysql_ds-mysql_table", _id: "mysql_ds-mysql_table",
name: "MySQL table", name: "MySQL table",
}, },
}, ].map(t => ({
} ...t,
sourceId: mysqlDatasource._id,
})),
]
const datasources = { const datasources = {
list: [internalTables, pgDatasource, mysqlDatasource], list: [internalTables, pgDatasource, mysqlDatasource],
@ -137,7 +149,7 @@ describe("datasourceUtils", () => {
datasources, datasources,
{}, {},
isActive, isActive,
"", { list: tables },
{ list: [] }, { list: [] },
{ list: [] }, { list: [] },
{ list: [] }, { list: [] },
@ -176,7 +188,7 @@ describe("datasourceUtils", () => {
datasources, datasources,
{}, {},
isActive, isActive,
"", { list: tables },
{ list: [] }, { list: [] },
{ list: [] }, { list: [] },
{ list: [] }, { list: [] },