riot-testing-library
riot-testing-library builds on top of
DOM Testing Library by
adding APIs for working with Riot.js components.
npm install --save-dev riot-testing-library
import render, { fireEvent } from 'riot-testing-library'
import TestTag from './test.tag'
test('should show count text when rendered', () => {
const { queryByTestId } = render(TestTag, { count: 10 })
expect(queryByTestId('count').textContent).toBe('10')
})
test('should add count when click add button text', () => {
const { queryByTestId } = render(TestTag, { count: 1 })
expect(queryByTestId('count').textContent).toBe('1')
fireEvent.click(queryByTestId('button'))
expect(queryByTestId('count').textContent).toBe('2')
})