Skip to content

Commit 84292f6

Browse files
committed
add coverage for several exports in one component
Signed-off-by: Winner95 <Winner95@users.noreply.github.com>
1 parent c3726c1 commit 84292f6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

__tests__/handler.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ describe('typescript-react-function-component-props-handler', () => {
114114
expect(doc.props).toBeUndefined();
115115
});
116116

117+
// @TODO add description about error for "Multiple exported component definitions found."
118+
// when several exported components are present in a single file - use different setup for parsing
119+
test('handles several export React.FC<Props> components with error', () => {
120+
expect(() => parseFixture('SeveralExportsComponent.tsx')).toThrow(
121+
"Multiple exported component definitions found."
122+
);
123+
});
124+
117125
// Line 31 in index.js without type - can't be tested directly because of early return
118126
test('handles components without type', () => {
119127
const doc = parseFixture('ComponentWithoutType.tsx');
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
type NoParamProps = {
4+
label: string;
5+
};
6+
7+
export const NoParamComponent: React.FC<NoParamProps> = () => {
8+
return <div>Hi</div>;
9+
};
10+
11+
export default NoParamComponent;

0 commit comments

Comments
 (0)