Clean names

This commit is contained in:
Adria Navarro 2023-11-20 13:26:31 +01:00
parent 1449560ab3
commit ab31d90de8
1 changed files with 25 additions and 92 deletions

View File

@ -15,42 +15,23 @@ describe("datasourceUtils", () => {
describe("filtering", () => { describe("filtering", () => {
const internalTables = { const internalTables = {
_id: "datasource_internal_bb_default", _id: "datasource_internal_bb_default",
type: "budibase",
name: "Sample Data", name: "Sample Data",
source: "BUDIBASE",
config: {},
entities: [ entities: [
{ {
_id: "ta_bb_employee", _id: "ta_bb_employee",
type: "table",
name: "Employees", name: "Employees",
sourceId: "datasource_internal_bb_default",
sourceType: "internal",
}, },
{ {
_id: "ta_bb_expenses", _id: "ta_bb_expenses",
type: "table",
views: {},
name: "Expenses", name: "Expenses",
sourceId: "datasource_internal_bb_default",
sourceType: "internal",
}, },
{ {
_id: "ta_bb_inventory", _id: "ta_bb_inventory",
type: "table",
views: {},
sourceId: "datasource_internal_bb_default",
sourceType: "internal",
primaryDisplay: "Item Name",
name: "Inventory", name: "Inventory",
}, },
{ {
_id: "ta_bb_jobs", _id: "ta_bb_jobs",
type: "table",
name: "Jobs", name: "Jobs",
sourceId: "datasource_internal_bb_default",
sourceType: "internal",
primaryDisplay: "Job ID",
}, },
], ],
} }
@ -58,96 +39,48 @@ describe("datasourceUtils", () => {
const pgDatasource = { const pgDatasource = {
_id: "pg_ds", _id: "pg_ds",
name: "PostgreSQL local", name: "PostgreSQL local",
plus: true,
entities: { entities: {
"mic moc": { "External Inventory": {
type: "table", _id: "pg_ds-external_inventory",
_id: "datasource_plus_865bf332f37f454b82e2d371be90a0ef__mic%20moc", name: "External Inventory",
primary: ["id"],
name: "mic moc",
sourceId: "datasource_plus_865bf332f37f454b82e2d371be90a0ef",
sourceType: "external",
primaryDisplay: "Column 01",
views: { views: {
"mic view": { "External Inventory first view": {
name: "mic view", name: "External Inventory first view",
tableId: id: "pg_ds_view_1",
"datasource_plus_865bf332f37f454b82e2d371be90a0ef__mic%20moc", },
query: null, "External Inventory second view": {
sort: { field: null, order: "ascending" }, name: "External Inventory second view",
schema: { id: "pg_ds_view_2",
"Column 01": { visible: true },
"Column 02": { visible: true },
id: { visible: true },
},
primaryDisplay: "Column 01",
id: "view_datasource_plus_865bf332f37f454b82e2d371be90a0ef__mic%20moc_201b0c7a6766423a8abab64fd31bc9dc",
version: 2,
}, },
}, },
}, },
"table 1": { "Another table": {
type: "table", _id: "pg_ds-another_table",
_id: "datasource_plus_865bf332f37f454b82e2d371be90a0ef__table%201", name: "Another table",
primary: ["id"],
name: "table 1",
sourceId: "datasource_plus_865bf332f37f454b82e2d371be90a0ef",
sourceType: "external",
primaryDisplay: "Column 01",
views: { views: {
fr: { view1: {
id: "view_datasource_plus_865bf332f37f454b82e2d371be90a0ef__table%201_f8a0299dfb9b4423b2a88809c2ee0bcb", id: "pg_ds-another_table-view1",
name: "fr", name: "view1",
version: 2, },
tableId: ["View 2"]: {
"datasource_plus_865bf332f37f454b82e2d371be90a0ef__table%201", id: "pg_ds-another_table-view2",
query: null, name: "View 2",
sort: { field: null, order: "ascending" },
schema: {
"Column 01": { width: 200, visible: true },
id: { order: 1, width: 200, visible: true },
},
primaryDisplay: "Column 01",
}, },
}, },
}, },
test2: { table2: {
type: "table", _id: "pg_ds_table2",
_id: "datasource_plus_865bf332f37f454b82e2d371be90a0ef__test2", name: "table2",
primary: ["id"],
name: "test2",
sourceId: "datasource_plus_865bf332f37f454b82e2d371be90a0ef",
sourceType: "external",
sql: true,
views: { views: {
"new 2": { "new 2": {
name: "new 2", name: "new 2",
tableId: id: "pg_ds_table2_new_2",
"datasource_plus_865bf332f37f454b82e2d371be90a0ef__test2",
query: null,
sort: { field: null, order: "ascending" },
schema: {
id: { visible: true },
"Column 01": { visible: true },
},
primaryDisplay: "id",
id: "view_datasource_plus_865bf332f37f454b82e2d371be90a0ef__test2_cdb7ea28c0104dfb93309c54276d28cd",
version: 2,
}, },
new: { new: {
id: "view_datasource_plus_865bf332f37f454b82e2d371be90a0ef__test2_b7848afdbca54cd488f3eabf8be56e07",
name: "new", name: "new",
version: 2, id: "pg_ds_table2_new_",
tableId:
"datasource_plus_865bf332f37f454b82e2d371be90a0ef__test2",
query: null,
sort: { field: null, order: "ascending" },
schema: { id: { width: 200, visible: true } },
primaryDisplay: "id",
}, },
}, },
primaryDisplay: "id",
indexes: [],
}, },
}, },
} }