zipkin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From unknown ...@apache.org>
Subject [incubator-zipkin] 05/09: Add unit tests for MiniTimelineTimeMarker
Date Thu, 09 May 2019 04:52:49 GMT
This is an automated email from the ASF dual-hosted git repository.

(unknown) pushed a commit to branch mini-timeline
in repository https://gitbox.apache.org/repos/asf/incubator-zipkin.git

commit 36a72d0129680304297d424b4573e2d91854afdc
Author: tacigar <ig.lhound@gmail.com>
AuthorDate: Wed May 8 20:18:46 2019 +0900

    Add unit tests for MiniTimelineTimeMarker
---
 .../src/components/MiniTimeline/MiniTimelineGraph.js       |  4 ++--
 .../{MiniTimelineMarkers.js => MiniTimelineTimeMarkers.js} |  0
 .../MiniTimeline/MiniTimelineTimeMarkers.test.js           | 14 ++++++++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/zipkin-lens/src/components/MiniTimeline/MiniTimelineGraph.js b/zipkin-lens/src/components/MiniTimeline/MiniTimelineGraph.js
index 5f4327b..8c2c0d3 100644
--- a/zipkin-lens/src/components/MiniTimeline/MiniTimelineGraph.js
+++ b/zipkin-lens/src/components/MiniTimeline/MiniTimelineGraph.js
@@ -1,7 +1,7 @@
 import PropTypes from 'prop-types';
 import React from 'react';
 
-import MiniTimelineMarkers from './MiniTimelineMarkers';
+import MiniTimelineTimeMarkers from './MiniTimelineTimeMarkers';
 import { getGraphHeight, getGraphLineHeight } from './util';
 import { getServiceNameColor } from '../../util/color';
 import { detailedSpansPropTypes } from '../../prop-types';
@@ -91,7 +91,7 @@ class MiniTimelineGraph extends React.Component {
         onMouseDown={this.handleMouseDown}
       >
         <svg version="1.1" width="100%" height={graphHeight} xmlns="http://www.w3.org/2000/svg">
-          <MiniTimelineMarkers
+          <MiniTimelineTimeMarkers
             height={graphHeight}
             numTimeMarkers={numTimeMarkers}
           />
diff --git a/zipkin-lens/src/components/MiniTimeline/MiniTimelineMarkers.js b/zipkin-lens/src/components/MiniTimeline/MiniTimelineTimeMarkers.js
similarity index 100%
rename from zipkin-lens/src/components/MiniTimeline/MiniTimelineMarkers.js
rename to zipkin-lens/src/components/MiniTimeline/MiniTimelineTimeMarkers.js
diff --git a/zipkin-lens/src/components/MiniTimeline/MiniTimelineTimeMarkers.test.js b/zipkin-lens/src/components/MiniTimeline/MiniTimelineTimeMarkers.test.js
new file mode 100644
index 0000000..cefb995
--- /dev/null
+++ b/zipkin-lens/src/components/MiniTimeline/MiniTimelineTimeMarkers.test.js
@@ -0,0 +1,14 @@
+import React from 'react';
+import { shallow } from 'enzyme';
+
+import MiniTimelineTimeMarkers from './MiniTimelineTimeMarkers';
+
+describe('<MiniTimelineTimeMarkers />', () => {
+  it('should set proper positions', () => {
+    const wrapper = shallow(<MiniTimelineTimeMarkers height={75} numTimeMarkers={5} />);
+    const timeMarkers = wrapper.find('line');
+    expect(timeMarkers.at(0).prop('x1')).toEqual('25%');
+    expect(timeMarkers.at(1).prop('x1')).toEqual('50%');
+    expect(timeMarkers.at(2).prop('x1')).toEqual('75%');
+  });
+});


Mime
View raw message