diff --git a/src/renderer/components/+catalog/catalog.test.tsx b/src/renderer/components/+catalog/catalog.test.tsx
index b10a71d95b..cff26d9ab9 100644
--- a/src/renderer/components/+catalog/catalog.test.tsx
+++ b/src/renderer/components/+catalog/catalog.test.tsx
@@ -167,7 +167,7 @@ describe("", () => {
setTimeout(() => {
expect(onRun).toHaveBeenCalled();
done();
- }, 800);
+ }, 500);
return true;
}
@@ -184,4 +184,48 @@ describe("", () => {
userEvent.click(screen.getByTestId("detail-panel-hot-bar-icon"));
});
+
+ it("addOnRunHook return false => onRun wont be triggered", (done) => {
+ const onRun = jest.fn();
+ const catalogEntityItem = new CatalogEntityItem({
+ ...catalogEntity,
+ ...catalogEntityItemMethods,
+ onRun,
+ });
+
+ const catalogCategoryRegistry = new CatalogCategoryRegistry();
+ const catalogEntityRegistry = new CatalogEntityRegistry(catalogCategoryRegistry);
+ const catalogEntityStore = new CatalogEntityStore(catalogEntityRegistry);
+
+ // mock as if there is a selected item > the detail panel opens
+ jest
+ .spyOn(catalogEntityStore, "selectedItem", "get")
+ .mockImplementation(() => {
+ return catalogEntityItem;
+ });
+
+ const onRunDisposer = catalogEntityRegistry.addOnRunHook(
+ catalogEntityUid,
+ () => {
+ onRunDisposer?.();
+ setTimeout(() => {
+ expect(onRun).not.toHaveBeenCalled();
+ done();
+ }, 500);
+
+ return false;
+ }
+ );
+
+ render(
+
+ );
+
+ userEvent.click(screen.getByTestId("detail-panel-hot-bar-icon"));
+ });
});