Filter out unknown catalog entities (#2816)

* Filter out unknown catelog entities

- Keep raw data

- But filter unknown types until a category is registered

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix unit tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* simplify tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove getOrDefault, consolodate ExtendedMap

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-05-20 08:50:51 +03:00
1 parent 5ed4537979
commit b61ba7ef71
4 files changed
+71 -49

No files matched your search

@@ -42,7 +42,7 @@ describe("CatalogEntityRegistry", () => {
spec: {}
}];
catalog.updateItems(items);
(catalog as any).rawItems.replace(items);
expect(catalog.items.length).toEqual(1);
items.push({
@@ -60,7 +60,7 @@ describe("CatalogEntityRegistry", () => {
spec: {}
});
catalog.updateItems(items);
(catalog as any).rawItems.replace(items);
expect(catalog.items.length).toEqual(2);
});
@@ -81,13 +81,13 @@ describe("CatalogEntityRegistry", () => {
spec: {}
}];
catalog.updateItems(items);
(catalog as any).rawItems.replace(items);
expect(catalog.items.length).toEqual(1);
expect(catalog.items[0].status.phase).toEqual("disconnected");
items[0].status.phase = "connected";
catalog.updateItems(items);
(catalog as any).rawItems.replace(items);
expect(catalog.items.length).toEqual(1);
expect(catalog.items[0].status.phase).toEqual("connected");
});
@@ -125,9 +125,9 @@ describe("CatalogEntityRegistry", () => {
}
];
catalog.updateItems(items);
(catalog as any).rawItems.replace(items);
items.splice(0, 1);
catalog.updateItems(items);
(catalog as any).rawItems.replace(items);
expect(catalog.items.length).toEqual(1);
expect(catalog.items[0].metadata.uid).toEqual("456");
});