|
|
|
@@ -0,0 +1,24 @@ |
|
|
|
import Button from './Button' |
|
|
|
import ReactDOM from 'react-dom' |
|
|
|
import React from 'react' |
|
|
|
import { getByTestId, render, screen } from '@testing-library/react'; |
|
|
|
|
|
|
|
describe("Button tests", () =>{ |
|
|
|
it("render without crashing", () => |
|
|
|
{ |
|
|
|
const div = document.createElement('div'); |
|
|
|
ReactDOM.render(<Button></Button>, div); |
|
|
|
}) |
|
|
|
|
|
|
|
it("render button with base class",() => |
|
|
|
{ |
|
|
|
render(<Button></Button>); |
|
|
|
expect(screen.getByTestId('btn')).toHaveClass("c-btn"); |
|
|
|
}) |
|
|
|
|
|
|
|
it("render button with size 5",() => |
|
|
|
{ |
|
|
|
render(<Button size={5}></Button>); |
|
|
|
expect(screen.getByTestId('btn')).toHaveClass("c-btn--5"); |
|
|
|
}) |
|
|
|
}) |