import React from 'react'; import '@testing-library/jest-dom'; import { cleanup, render } from '@testing-library/react'; import SolarCast from './SolarCast'; import { clear} from 'jest-date-mock'; import { urlEvents, views } from './mocks'; // These lengths should always be longer than 8s // Due the the max loading time defined in // ./src/Package/Components/ViewRenderer.tsx beforeEach(() => { jest.useFakeTimers(); }); afterEach(() => { clear(); cleanup(); jest.clearAllTimers(); jest.useRealTimers(); }); /** * ░ 0 * ▓ 1 * ░ 2 * ▓ 3 * ▓ 4 * > ░ 5 */ it('Solarcast should render correctly at url event index 5', function () { const { queryByTestId } = render( ); expect(queryByTestId('view-idle')).toBeInTheDocument(); expect(queryByTestId('view-url-1')).not.toBeInTheDocument(); expect(queryByTestId('view-url-2')).not.toBeInTheDocument(); expect(queryByTestId('view-url-3')).not.toBeInTheDocument(); });