/* global afterEach, describe, expect, test */ import React from 'react' import { render, cleanup } from 'react-testing-library' // What to test import reactTimeout from '..' class TestClass extends React.Component { render () { return (
{typeof this.props[this.props.queryFunction]}
) } } const TestClassWithTimeout = reactTimeout(TestClass) // The tests afterEach(cleanup) describe('has all the functions`', () => { test('setTimeout', () => { const t = render() expect(t.getByTestId('function-type').textContent).toBe('function') }) test('clearTimeout', () => { const t = render() expect(t.getByTestId('function-type').textContent).toBe('function') }) test('setInterval', () => { const t = render() expect(t.getByTestId('function-type').textContent).toBe('function') }) test('clearInterval', () => { const t = render() expect(t.getByTestId('function-type').textContent).toBe('function') }) test('setImmediate', () => { const t = render() expect(t.getByTestId('function-type').textContent).toBe('function') }) test('clearImmediate', () => { const t = render() expect(t.getByTestId('function-type').textContent).toBe('function') }) test('requestAnimationFrame', () => { const t = render() expect(t.getByTestId('function-type').textContent).toBe('function') }) test('cancelAnimationFrame', () => { const t = render() expect(t.getByTestId('function-type').textContent).toBe('function') }) })