Skip to content

Commit de8bbc6

Browse files
committed
name change Map to ComponentMap Chart to History
1 parent c0ea64b commit de8bbc6

File tree

3 files changed

+43
-8
lines changed

3 files changed

+43
-8
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react';
2+
import { configure, mount } from 'enzyme';
3+
import Adapter from 'enzyme-adapter-react-16';
4+
import ComponentMap from '../components/ComponentMap'
5+
import * as d3 from 'd3'
6+
7+
describe('canvas', ()=> {
8+
const getCanvas = () => {
9+
console.log(d3.select('#canvas'))
10+
return d3.select('#canvas')
11+
}
12+
13+
it ('should exist', ()=>{
14+
expect(getCanvas()).not.toBeNull();
15+
})
16+
})

src/app/__tests__/Chart.test.tsx renamed to src/app/__tests__/History.test.tsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,40 @@
77
import React from 'react';
88
import { configure, mount } from 'enzyme';
99
import Adapter from 'enzyme-adapter-react-16';
10+
import History from '../components/History';
1011

11-
const Chart = require('../components/Chart').default;
1212

1313
// Unit test cases for d3 functionality
1414
configure({ adapter: new (Adapter as any)() });
1515

16-
// Test the life cycle methods in Chart
17-
describe('Life cycle methods in Chart', () => {
16+
// Test the life cycle methods in History
17+
describe('Life cycle methods in History', () => {
1818
let wrapper;
1919
const props = {
20-
hierarchy: 0,
20+
hierarchy: {
21+
branch: 0,
22+
children : [
23+
{
24+
index:1,
25+
name:2,
26+
branch:0,
27+
stateSnapshot:{},
28+
children: []
29+
}
30+
],
31+
index : 0,
32+
name : 1,
33+
stateSnapshot : {
34+
children:[{}],
35+
componentData: {},
36+
name: "root",
37+
state: "root"
38+
}
39+
},
2140
};
2241
// Set up wrapper
2342
beforeEach(() => {
24-
wrapper = mount(<Chart {...props} />);
43+
wrapper = mount(<History {...props} />);
2544
});
2645
// test componentDidMount
2746
it('should call componentDidMount once', () => {
@@ -65,7 +84,7 @@ describe('Root object', () => {
6584
};
6685
// Set up wrapper
6786
beforeEach(() => {
68-
wrapper = mount(<Chart {...props} />);
87+
wrapper = mount(<History {...props} />);
6988
});
7089

7190
// eslint-disable-next-line jest/no-disabled-tests
@@ -85,7 +104,7 @@ describe('maked3Tree method', () => {
85104
};
86105
// Set up wrapper
87106
beforeEach(() => {
88-
wrapper = mount(<Chart {...props} />);
107+
wrapper = mount(<History {...props} />);
89108
});
90109
// Test the invocation of removed3Tree within maked3Tree
91110
it('should call removed3Tree once', () => {

src/app/components/History.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class History extends Component {
7373
*/
7474
maked3Tree(): void {
7575
this.removed3Tree();
76-
76+
console.log("HIEARARCHY", this.props.hierarchy)
7777
const width : number = 800;
7878
const height : number = 600;
7979
const svgContainer = d3

0 commit comments

Comments
 (0)