From 9910f042d177ca056c374d67838c948a281cc2b7 Mon Sep 17 00:00:00 2001 From: Janne Savolainen Date: Tue, 28 Jun 2022 08:44:39 +0300 Subject: [PATCH] Mock uninterested, non-deterministic third party library in unit tests Co-authored-by: Mikko Aspiala Signed-off-by: Janne Savolainen --- __mocks__/react-beautiful-dnd.tsx | 15 +++++++++++++++ src/renderer/components/hotbar/hotbar-menu.tsx | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 __mocks__/react-beautiful-dnd.tsx diff --git a/__mocks__/react-beautiful-dnd.tsx b/__mocks__/react-beautiful-dnd.tsx new file mode 100644 index 0000000000..6404bfd450 --- /dev/null +++ b/__mocks__/react-beautiful-dnd.tsx @@ -0,0 +1,15 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ +import React from "react"; + +import type { + DragDropContextProps, + DraggableProps, + DroppableProps, +} from "react-beautiful-dnd"; + +export const DragDropContext = ({ children }: DragDropContextProps) => <>{ children }; +export const Draggable = ({ children }: DraggableProps) => <>{ children }; +export const Droppable = ({ children }: DroppableProps) => <>{ children }; diff --git a/src/renderer/components/hotbar/hotbar-menu.tsx b/src/renderer/components/hotbar/hotbar-menu.tsx index 9e3b9e5488..05e11bf659 100644 --- a/src/renderer/components/hotbar/hotbar-menu.tsx +++ b/src/renderer/components/hotbar/hotbar-menu.tsx @@ -184,7 +184,9 @@ class NonInjectedHotbarMenu extends React.Component
- this.onDragStart()} onDragEnd={(result) => this.onDragEnd(result)}> + this.onDragStart()} + onDragEnd={(result) => this.onDragEnd(result)}> {this.renderGrid()}