From 20207145addfd2d98ec812b7108fda30f57ef714 Mon Sep 17 00:00:00 2001 From: Christopher LeBrett Date: Wed, 15 Jun 2022 08:42:03 -0700 Subject: [PATCH] added RouteDescription tests Co-authored-by: Chris LeBrett <100822842+fscgolden@users.noreply.github.com> Co-authored-by: Robby Tipton <100332566+RobbyTipton@users.noreply.github.com> Co-authored-by: Joseph Park <10874783+joeepark@users.noreply.github.com> Co-authored-by: David Kim <101825171+codejunkie7@users.noreply.github.com> Co-authored-by: Kevin HoEun Lee <14950124+khobread@users.noreply.github.com> --- src/app/__tests__/RouteDescription.test.tsx | 67 +++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/app/__tests__/RouteDescription.test.tsx 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'); + }); +});