Skip to content

Commit 3a12012

Browse files
committed
CR feedback - update to FileTree mock
1 parent 0c4b5e8 commit 3a12012

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

packages/components/src/internal/components/ontology/OntologyTreePanel.test.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ jest.mock('./actions', () => ({
1010
fetchParentPaths: jest.fn().mockResolvedValue([]),
1111
}));
1212

13-
jest.mock('../files/FileTree', () => ({
14-
DEFAULT_ROOT_PREFIX: '|root',
15-
FileTree: () => <div className="mock-file-tree" />,
16-
}));
13+
jest.mock('../files/FileTree', () => {
14+
// Declaring as a class since functional components do not receive refs (which FileTree does)
15+
class mockFileTree extends React.PureComponent {
16+
render() {
17+
return <div className="mock-file-tree" />;
18+
}
19+
}
20+
21+
return {
22+
DEFAULT_ROOT_PREFIX: '|root',
23+
FileTree: mockFileTree,
24+
};
25+
});
1726

1827
const DEFAULT_PROPS = {
1928
root: new PathModel({ label: 'test label' }),

0 commit comments

Comments
 (0)