From d8590caa241814100cc78976b95587be4032cbb4 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 20 Nov 2023 13:34:10 +0100 Subject: [PATCH] Add extra tests --- .../tests/datasourceUtils.spec.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/tests/datasourceUtils.spec.js b/packages/builder/src/components/backend/DatasourceNavigator/tests/datasourceUtils.spec.js index 8dbbe6c21b..1a10b9bf7d 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/tests/datasourceUtils.spec.js +++ b/packages/builder/src/components/backend/DatasourceNavigator/tests/datasourceUtils.spec.js @@ -168,6 +168,40 @@ describe("datasourceUtils", () => { }), ]) }) + + it("given a non matching search term, all entities are empty", () => { + const searchTerm = "non matching" + + const result = enrichDatasources( + datasources, + {}, + isActive, + "", + { list: [] }, + { list: [] }, + { list: [] }, + {}, + searchTerm + ) + + expect(result).toEqual([ + expect.objectContaining({ + _id: internalTables._id, + show: false, + tables: [], + }), + expect.objectContaining({ + _id: pgDatasource._id, + show: false, + tables: [], + }), + expect.objectContaining({ + _id: mysqlDatasource._id, + show: false, + tables: [], + }), + ]) + }) }) }) })