import {render, screen} from '@testing-library/react'
import ActionButton from '.'

describe('button component for triggering actions', () => {
	it('should render a button element with a no-op action', () => {
		render(<ActionButton />)
		expect(screen.getByRole('button')).toBeInTheDocument()
	})

	describe.each(['button', 'reset', 'submit'] as const)('on %p action', (type) => {
		beforeEach(() => {
			render(<ActionButton type={type} />)
		})

		it('should render a button element with a submit action', () => {
			expect(screen.getByRole('button')).toHaveAttribute('type', type)
		})
	})
})
