diff --git a/src/app/__tests__/RouteDescription.test.tsx b/src/app/__tests__/RouteDescription.test.tsx new file mode 100644 index 000000000..d58aaa348 --- /dev/null +++ b/src/app/__tests__/RouteDescription.test.tsx @@ -0,0 +1,67 @@ +// @ts-nocheck +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable react/jsx-filename-extension */ + +import React from 'react'; +import { shallow, configure, render } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import Action from '../components/Action'; +import RouteDescription from '../components/RouteDescription'; + +configure({ adapter: new (Adapter as any)() }); + +describe('Unit testing RouteDescription', () => { + const actionsArr = []; + + actionsArr.push( + null} + sliderIndex={0} + handleOnkeyDown={(e, i) => null} + viewIndex={undefined} + isCurrIndex={false} + routePath="http://localhost:3000/home" + />, + ); + + actionsArr.push( + null} + sliderIndex={0} + handleOnkeyDown={(e, i) => null} + viewIndex={undefined} + isCurrIndex={false} + routePath="http://localhost:3000/home" + />, + ); + + const wrapper = shallow(); + + test('Renders the correct number of Action components', () => { + expect(wrapper.find(Action).length).toBe(2); + }); + + test('Renders a single ".route" class', () => { + expect(wrapper.find('.route').length).toBe(1); + }); + + test('Renders an h3 tag with the correct pathname "Route: "', () => { + expect(wrapper.find('h3').text()).toBe('Route: /home'); + }); +});