Test table filtering

This commit is contained in:
Adria Navarro 2023-11-20 13:33:36 +01:00
parent afaa0a70a9
commit 2e4cf53d05
1 changed files with 28 additions and 1 deletions

View File

@ -25,6 +25,10 @@ describe("datasourceUtils", () => {
_id: "ta_bb_expenses", _id: "ta_bb_expenses",
name: "Expenses", name: "Expenses",
}, },
{
_id: "ta_bb_expenses_2",
name: "Expenses 2",
},
{ {
_id: "ta_bb_inventory", _id: "ta_bb_inventory",
name: "Inventory", name: "Inventory",
@ -85,8 +89,19 @@ describe("datasourceUtils", () => {
}, },
} }
const mysqlDatasource = {
_id: "mysql_ds",
name: "My SQL local",
entities: {
"MySQL table": {
_id: "mysql_ds-mysql_table",
name: "MySQL table",
},
},
}
const datasources = { const datasources = {
list: [internalTables, pgDatasource], list: [internalTables, pgDatasource, mysqlDatasource],
} }
const isActive = vi.fn().mockReturnValue(true) const isActive = vi.fn().mockReturnValue(true)
@ -134,10 +149,22 @@ describe("datasourceUtils", () => {
expect.objectContaining({ expect.objectContaining({
_id: internalTables._id, _id: internalTables._id,
show: true, show: true,
tables: [
expect.objectContaining({ _id: "ta_bb_expenses" }),
expect.objectContaining({ _id: "ta_bb_expenses_2" }),
],
}), }),
expect.objectContaining({ expect.objectContaining({
_id: pgDatasource._id, _id: pgDatasource._id,
show: true, show: true,
tables: [
expect.objectContaining({ _id: "pg_ds-external_inventory" }),
],
}),
expect.objectContaining({
_id: mysqlDatasource._id,
show: false,
tables: [],
}), }),
]) ])
}) })