forked from FDIM/jasmine-unit-test-generator
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jest-test-gen 1.2.0 add outputDir and support for ts and tsx components
- Loading branch information
Showing
15 changed files
with
391 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { Component } from 'react'; // let's also import Component | ||
|
||
type ClockProps = { | ||
greeting: string, | ||
myTime: Date, | ||
cb?: () => void, | ||
} | ||
export class MyComp extends Component<ClockProps> { | ||
|
||
render() { | ||
return <p>The prop is {this.props.greeting}</p> | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
spec/fixtures/components/tsFunctionalComponenetInferFromPropTypes.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from 'react'; | ||
import * as PropTypes from 'prop-types'; | ||
|
||
export const userInfo = { | ||
contactId: PropTypes.string, | ||
isOpen: PropTypes.bool, | ||
}; | ||
|
||
export type UserInfoProps = PropTypes.InferProps<typeof userInfo>; | ||
|
||
const UserInfo: React.FC<UserInfoProps> = ({ | ||
contactId, | ||
isOpen = false, | ||
}) => { | ||
return ( | ||
<p>User Info: {contactId} {isOpen}</p> | ||
); | ||
}; | ||
|
||
export default UserInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, { FunctionComponent } from 'react'; // importing FunctionComponent | ||
|
||
type CardParagraph = { | ||
content: string | ||
} | ||
|
||
type CardProps = { | ||
title: string, | ||
paragraph: CardParagraph | ||
} | ||
|
||
export const Card: FunctionComponent<CardProps> = ({ title, paragraph }) => <aside> | ||
<h2>{ title }</h2> | ||
<p> | ||
{ paragraph.content } | ||
</p> | ||
</aside> | ||
|
||
const el = <Card title="Welcome!" paragraph={{content:"To this example"}} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from 'react'; | ||
|
||
type CardProps = { | ||
title: string, | ||
paragraph: string | ||
} | ||
|
||
export const Card: React.FC<CardProps> = ({ title, paragraph }) => <aside> | ||
<h2>{ title }</h2> | ||
<p> | ||
{ paragraph } | ||
</p> | ||
</aside> | ||
|
||
const el = <Card title="Welcome!" paragraph="To this example" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; // we need this to make JSX compile | ||
|
||
type CardParagraph = { | ||
content: string | ||
} | ||
|
||
type CardProps = { | ||
title: string, | ||
paragraph: CardParagraph | ||
myOptionalString?: string | ||
} | ||
|
||
export const Card = ({ title, paragraph }: CardProps) => <aside> | ||
<h2>{ title }</h2> | ||
<p> | ||
{ paragraph } | ||
</p> | ||
</aside> | ||
|
||
const el = <Card title="Welcome!" paragraph={{ content: "To this example" }} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; // we need this to make JSX compile | ||
|
||
type CardProps = { | ||
title: string, | ||
items: string[] | ||
} | ||
|
||
export const CardItems = ({ title, items }: CardProps) => <aside> | ||
<h2>{ title }</h2> | ||
<p> | ||
{ items.join(',') } | ||
</p> | ||
</aside> | ||
|
||
const el = <CardItems title="Welcome!" items={['a','b','c']} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; // we need this to make JSX compile | ||
|
||
type CardParagraph = { | ||
content: string | ||
} | ||
|
||
type CardProps = { | ||
title: string, | ||
paragraph: CardParagraph | ||
myOptionalString?: string | ||
} | ||
|
||
export function Card({ title, paragraph }: CardProps) { | ||
return <aside> | ||
<h2>{ title }</h2> | ||
<p> | ||
{ paragraph } | ||
</p> | ||
</aside> | ||
} | ||
const el = <Card title="Welcome!" paragraph={{ content: "To this example" }} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.