Skip to content

Commit 3ac86d9

Browse files
authored
test: add unit tests (#101)
1 parent dd8c138 commit 3ac86d9

14 files changed

+122
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "Foo",
3+
"path": "arrow-function/component-with-default-value.tsx",
4+
"description": "",
5+
"properties": [
6+
{
7+
"name": "onClick",
8+
"type": "() => void | Promise<void>",
9+
"defaultValue": "() => {}",
10+
"optional": true
11+
}
12+
]
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export interface Props {
2+
onClick?: () => void | Promise<void>
3+
}
4+
5+
export const Foo = ({ onClick = () => {} }: Props) => {
6+
return <button onClick={onClick}>foo</button>
7+
}

packages/node-react-parser/src/__fixtures__/all-use-cases/arrow-function/component-with-documentation.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "Foo",
3+
"path": "arrow-function/component-with-global-deprecated.tsx",
4+
"description": "A Button component",
5+
"deprecated": true,
6+
"properties": []
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface Props {}
2+
3+
/**
4+
* A Button component
5+
* @deprecated
6+
*/
7+
export const Foo = () => {
8+
return <div>foo</div>
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "Foo",
3+
"path": "arrow-function/component-with-global-documentation.tsx",
4+
"description": "A Button component",
5+
"properties": [
6+
{
7+
"name": "children",
8+
"type": "React.ReactNode"
9+
}
10+
]
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export interface Props {
2+
children: React.ReactNode
3+
}
4+
5+
/**
6+
* A Button component
7+
*/
8+
export function Foo({ children }: Props) {
9+
return <div>{children}</div>
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "Foo",
3+
"path": "arrow-function/component-with-optional.tsx",
4+
"description": "",
5+
"properties": [
6+
{
7+
"name": "onClick",
8+
"type": "() => void | Promise<void>",
9+
"optional": true
10+
}
11+
]
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export interface Props {
2+
onClick?: () => void | Promise<void>
3+
}
4+
5+
export const Foo = ({ onClick }: Props) => {
6+
return <button onClick={onClick}>foo</button>
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "Foo",
3+
"path": "arrow-function/component-with-property-deprecated.tsx",
4+
"description": "",
5+
"properties": [
6+
{
7+
"name": "variant",
8+
"type": "'primary' | 'black' | 'basic'",
9+
"deprecated": true
10+
}
11+
]
12+
}

0 commit comments

Comments
 (0)