1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00
market/tests/unit/components/Button.test.tsx

33 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-05-07 08:03:30 +02:00
import React from 'react'
import { render } from '@testing-library/react'
import Button from '../../../src/components/atoms/Button'
describe('Button', () => {
it('primary renders correctly', () => {
const { container } = render(<Button primary>I am a primary button</Button>)
const button = container.querySelector('button')
expect(button).toBeInTheDocument()
expect(button).toHaveTextContent('primary')
expect(button && button.className).toMatch(/primary/)
})
it('href renders correctly without crashing', () => {
const { container } = render(
<Button href="https://hello.com">I am a href button</Button>
)
const button = container.querySelector('a')
expect(button).toBeInTheDocument()
expect(button).toHaveTextContent('href')
})
it('link renders correctly without crashing', () => {
const { container } = render(<Button link>I am a link button</Button>)
const button = container.querySelector('button')
expect(button).toBeInTheDocument()
expect(button).toHaveTextContent('link')
expect(button && button.className).toMatch(/link/)
})
})