Skip to content

Commit 077b5f9

Browse files
committed
merge
2 parents 2eb7b73 + eb57db9 commit 077b5f9

File tree

11 files changed

+47
-36
lines changed

11 files changed

+47
-36
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
"@babel/plugin-proposal-decorators": "^7.10.5",
7575
"@babel/preset-env": "^7.12.7",
7676
"@babel/preset-react": "^7.12.7",
77+
"@testing-library/jest-dom": "^4.2.4",
78+
"@types/chai": "^4.2.14",
7779
"@types/chrome": "^0.0.119",
7880
"@types/d3-scale-chromatic": "^2.0.0",
7981
"@types/jest": "^26.0.4",
@@ -85,7 +87,7 @@
8587
"core-js": "^3.6.5",
8688
"css-loader": "^3.6.0",
8789
"enzyme": "^3.11.0",
88-
"enzyme-adapter-react-16": "^1.15.2",
90+
"enzyme-adapter-react-16": "^1.15.6",
8991
"eslint": "^6.8.0",
9092
"eslint-config-airbnb": "^18.2.0",
9193
"eslint-plugin-import": "^2.22.0",
@@ -107,6 +109,7 @@
107109
"style-loader": "^0.23.1",
108110
"ts-jest": "^26.1.2",
109111
"ts-loader": "^7.0.5",
112+
"ts-node": "^9.1.1",
110113
"typedoc": "^0.17.8",
111114
"typedoc-webpack-plugin": "^1.1.4",
112115
"typescript": "^3.9.6",
@@ -140,6 +143,7 @@
140143
"acorn": "^7.3.1",
141144
"acorn-jsx": "^5.2.0",
142145
"apexcharts": "^3.23.1",
146+
"chai": "^4.2.0",
143147
"cookie": "^0.4.1",
144148
"d3": "^5.16.0",
145149
"d3-scale-chromatic": "^2.0.0",

src/app/__tests__/ActionContainer.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ useStoreContext.mockImplementation(() => [state, dispatch]);
8282

8383
let wrapper;
8484

85+
//actionView={true} must be passed in to <ActionContainer /> in beforeEach() to deal with new
86+
//conditional rendering in ActionContainer that shows/hides time-travel functionality
87+
8588
beforeEach(() => {
86-
wrapper = shallow(<ActionContainer />);
89+
wrapper = shallow(<ActionContainer actionView={true}/>);
8790
useStoreContext.mockClear();
8891
dispatch.mockClear();
8992
});

src/app/__tests__/MainContainer.test.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Adapter from 'enzyme-adapter-react-16';
88
import MainContainer from '../containers/MainContainer';
99
import { useStoreContext } from '../store';
1010

11-
import HeadContainer from '../containers/HeadContainer';
1211
import ActionContainer from '../containers/ActionContainer';
1312
import StateContainer from '../containers/StateContainer';
1413
import TravelContainer from '../containers/TravelContainer';
@@ -50,7 +49,6 @@ describe('MainContainer rendering', () => {
5049
expect(wrapper.text()).toEqual(
5150
'No React application found. Please visit reactime.io to more info.If you are using a React application, make sure tha you application is running in development mode.NOTE: The React Developer Tools extension is also required for Reactime to run, if you do not already have it installed on your browser.',
5251
);
53-
expect(wrapper.find(HeadContainer).length).toBe(0);
5452
expect(wrapper.find(ActionContainer).length).toBe(0);
5553
expect(wrapper.find(StateContainer).length).toBe(0);
5654
expect(wrapper.find(TravelContainer).length).toBe(0);
@@ -66,7 +64,6 @@ describe('MainContainer rendering', () => {
6664
};
6765

6866
wrapper = shallow(<MainContainer />);
69-
expect(wrapper.find(HeadContainer).length).toBe(1);
7067
expect(wrapper.find(ActionContainer).length).toBe(1);
7168
expect(wrapper.find(StateContainer).length).toBe(1);
7269
expect(wrapper.find(TravelContainer).length).toBe(1);

src/app/__tests__/WebMetrics.test.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* eslint:disable */
2+
import React from 'react';
3+
import { shallow, configure } from 'enzyme';
4+
import Adapter from 'enzyme-adapter-react-16';
5+
import WebMetrics from '../components/WebMetrics';
6+
import { expect } from 'chai';
7+
8+
9+
//the WebMetrics container should render 4 <div/> elements, each with id="card"
10+
//the WebMetrics container is itself <div class="web-metrics-container" />
11+
configure({ adapter: new (Adapter as any)() });
12+
13+
let wrapper = shallow(<WebMetrics />);
14+
15+
16+
describe('WebMetrics graph testing', ()=> {
17+
it ('should have 1 div with id "card" ', () => {
18+
expect(wrapper.find('#card')).to.have.lengthOf(1);
19+
})
20+
21+
it ('should have 1 div with id "chart" ', () => {
22+
expect(wrapper.find('#chart')).to.have.lengthOf(1);
23+
})
24+
25+
26+
})
27+

src/app/components/WebMetrics.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import Charts from 'react-apexcharts';
33

4+
45
const radialGraph = (props) => {
56
const state = {
67
series: [props.series],

src/app/containers/ActionContainer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ function ActionContainer(props) {
115115
setActionView(true);
116116
}, []);
117117

118-
// this is not logging; the prop is not being udpdated or the component is not being re-rendered.
118+
//the conditional logic below will cause ActionContainer.test.tsx to fail as it cannot find the Empty button
119+
//UNLESS actionView={true} is passed into <ActionContainer /> in the beforeEach() call in ActionContainer.test.tsx
119120
return (
120121
<div id='action-id' className='action-container'>
121122
<div id='arrow'>

src/app/containers/HeadContainer.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/app/containers/MainContainer.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { useEffect, useState } from 'react';
2-
import HeadContainer from './HeadContainer';
32
import ActionContainer from './ActionContainer';
43
import StateContainer from './StateContainer';
54
import TravelContainer from './TravelContainer';
@@ -29,9 +28,6 @@ function MainContainer(): any {
2928
const toggleElem = document.querySelector('aside');
3029
toggleElem.classList.toggle('no-aside');
3130
};
32-
useEffect(() => {
33-
setActionView(true);
34-
}, []);
3531

3632
useEffect(() => {
3733
// only open port once
@@ -189,7 +185,6 @@ function MainContainer(): any {
189185

190186
return (
191187
<div className='main-container'>
192-
{/* <HeadContainer /> */}
193188
<div id='bodyContainer' className='body-container1'>
194189
<ActionContainer
195190
actionView={actionView}
@@ -198,7 +193,6 @@ function MainContainer(): any {
198193
/>
199194
{snapshots.length ? (
200195
<StateContainer
201-
toggleActionContainer={toggleActionContainer}
202196
webMetrics={webMetrics}
203197
viewIndex={viewIndex}
204198
snapshot={snapshotDisplay}

src/app/containers/StateContainer.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ interface StateContainerProps {
2424
}
2525
>;
2626
toggleActionContainer?: any;
27-
webMetrics: object;
27+
webMetrics?: object;
2828
AtomsRelationship?: any[];
2929
hierarchy: Record<string, unknown>;
30-
snapshots: [];
31-
viewIndex: number;
30+
snapshots?: [];
31+
viewIndex?: number;
3232
}
3333

3434
// eslint-disable-next-line react/prop-types
@@ -38,7 +38,6 @@ const StateContainer = (props: StateContainerProps): JSX.Element => {
3838
hierarchy,
3939
snapshots,
4040
viewIndex,
41-
toggleActionContainer,
4241
webMetrics,
4342
} = props;
4443

@@ -47,6 +46,10 @@ const StateContainer = (props: StateContainerProps): JSX.Element => {
4746
<div className='state-container'>
4847
<div className='main-navbar-container'>
4948
<div className='main-navbar-text'>
49+
<<<<<<< HEAD
50+
=======
51+
{' '}
52+
>>>>>>> eb57db934793cb1169b1a5946689e3df2d886d7f
5053
</div>
5154
<div className='main-navbar'>
5255
<NavLink

src/app/styles/components/_buttons.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,6 @@ aside {
361361
transform: none;
362362
}
363363
#arrow {
364-
// height: 10px !important;
365364
margin-bottom: 40px;
366-
<<<<<<< HEAD
367-
// margin-right: 20px;
368-
}
369-
=======
370-
margin-right: 20px;
371365
}
372366
/* ^ sidebar button open and closing functionality */
373-
>>>>>>> ed65fc7acb392828d0c86a3997518c11acbf9435

0 commit comments

Comments
 (0)