Skip to content

Instantly share code, notes, and snippets.

@akshayjai1
Created March 14, 2023 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akshayjai1/a97a1c924a4095344ad359b3706ec4b9 to your computer and use it in GitHub Desktop.
Save akshayjai1/a97a1c924a4095344ad359b3706ec4b9 to your computer and use it in GitHub Desktop.
Testing exports from library
import {
Button,
ButtonProps,
BrandComponent,
BrandComponentProps,
Typography,
TypographyProps,
} from './index'
describe('Component exports', () => {
it('exports a Button component', () => {
expect(Button).toBeDefined()
expect(typeof Button).toBe('function')
})
it('exports a ButtonProps type', () => {
type Props = ButtonProps
const props: Props = {
onClick: () => {},
}
expect(props).toBeDefined()
})
it('exports a BrandComponent component', () => {
expect(BrandComponent).toBeDefined()
expect(typeof BrandComponent).toBe('function')
})
it('exports a BrandComponentProps type', () => {
type Props = BrandComponentProps
const props: Props = {
variant: 'stacked',
}
expect(props).toBeDefined()
})
it('exports a Typography component', () => {
expect(Typography).toBeDefined()
expect(typeof Typography).toBe('function')
})
it('exports a TypographyProps type', () => {
type Props = TypographyProps
const props: Props = {
variant: 'h1',
}
expect(props).toBeDefined()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment