Skip to content

Commit

Permalink
Add DashboardUtils test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrunyon committed Oct 18, 2023
1 parent 3320144 commit 1a72b2a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/dashboard/src/DashboardUtils.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { connect } from 'react-redux';
import { canHaveRef } from './DashboardUtils';
import { type PanelProps } from './DashboardPlugin';

test('canHaveRef', () => {
function TestComponent() {
return <div>Test</div>;
}

class TestClass extends React.PureComponent<PanelProps> {
render() {
return <div>Test</div>;
}
}

expect(canHaveRef(TestComponent)).toBe(false);
expect(canHaveRef(React.forwardRef(TestComponent))).toBe(true);
expect(canHaveRef(TestClass)).toBe(true);
expect(
canHaveRef(connect(null, null, null, { forwardRef: true })(TestClass))
).toBe(true);
});

0 comments on commit 1a72b2a

Please sign in to comment.