/** * @jest-environment jsdom */ import * as React from 'react'; import 'jest-canvas-mock'; import { render } from '@testing-library/react'; import { COMPONENT_MODE_INITIAL, COMPONENT_MODE_LOADING, COMPONENT_MODE_ERROR, COMPONENT_MODE_EMPTY, COMPONENT_MODE_OK, ComponentModeWindow, } from '../../../src/ts'; describe('ComponentModeWindow', () => { test('COMPONENT_MODE_INITIAL', () => { const { container } = render( ); expect(container.firstChild).toBeFalsy(); }); test('COMPONENT_MODE_OK', () => { const { container } = render( ); expect(container.firstChild).toBeFalsy(); }); test('COMPONENT_MODE_OK', () => { const { getByAltText } = render( ); expect(getByAltText('Loading')).toBeTruthy(); }); test('COMPONENT_MODE_ERROR', () => { const { getByText } = render( ); expect(getByText('Something went wrong on our end')).toBeTruthy(); }); test('COMPONENT_MODE_EMPTY', () => { const { getByText } = render( ); expect( getByText('No data available based on your selections') ).toBeTruthy(); }); });