-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Chris LeBrett <[email protected]> Co-authored-by: Robby Tipton <[email protected]> Co-authored-by: Joseph Park <[email protected]> Co-authored-by: David Kim <[email protected]> Co-authored-by: Kevin HoEun Lee <[email protected]>
- Loading branch information
1 parent
7f88d45
commit 2020714
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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( | ||
<Action | ||
key="action0" | ||
index={0} | ||
state={{}} | ||
displayName="1.0" | ||
componentName="App" | ||
componentData={{ actualDuration: 0 }} | ||
selected={false} | ||
last={false} | ||
dispatch={() => null} | ||
sliderIndex={0} | ||
handleOnkeyDown={(e, i) => null} | ||
viewIndex={undefined} | ||
isCurrIndex={false} | ||
routePath="http://localhost:3000/home" | ||
/>, | ||
); | ||
|
||
actionsArr.push( | ||
<Action | ||
key="action1" | ||
index={0} | ||
state={{}} | ||
displayName="2.0" | ||
componentName="App" | ||
componentData={{ actualDuration: 0 }} | ||
selected={false} | ||
last={false} | ||
dispatch={() => null} | ||
sliderIndex={0} | ||
handleOnkeyDown={(e, i) => null} | ||
viewIndex={undefined} | ||
isCurrIndex={false} | ||
routePath="http://localhost:3000/home" | ||
/>, | ||
); | ||
|
||
const wrapper = shallow(<RouteDescription actions={actionsArr} />); | ||
|
||
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: <pathname>"', () => { | ||
expect(wrapper.find('h3').text()).toBe('Route: /home'); | ||
}); | ||
}); |