From commits-return-981-archive-asf-public=cust-asf.ponee.io@zipkin.apache.org Thu May 9 04:52:45 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 36005180763 for ; Thu, 9 May 2019 06:52:45 +0200 (CEST) Received: (qmail 26322 invoked by uid 500); 9 May 2019 04:52:44 -0000 Mailing-List: contact commits-help@zipkin.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zipkin.apache.org Delivered-To: mailing list commits@zipkin.apache.org Received: (qmail 26246 invoked by uid 99); 9 May 2019 04:52:44 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2019 04:52:44 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 6D227872D3; Thu, 9 May 2019 04:52:44 +0000 (UTC) Date: Thu, 09 May 2019 04:52:47 +0000 To: "commits@zipkin.apache.org" Subject: [incubator-zipkin] 03/09: Add unit tests for MiniTimeline MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: unknown <""@apache.org> In-Reply-To: <155737756403.20229.17552824916846010816@gitbox.apache.org> References: <155737756403.20229.17552824916846010816@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-zipkin X-Git-Refname: refs/heads/mini-timeline X-Git-Reftype: branch X-Git-Rev: a2acd13f7b93a04f341dced4b62aa7ffc02c94b6 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20190509045244.6D227872D3@gitbox.apache.org> 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 a2acd13f7b93a04f341dced4b62aa7ffc02c94b6 Author: tacigar AuthorDate: Wed May 8 19:48:39 2019 +0900 Add unit tests for MiniTimeline --- .../src/components/MiniTimeline/index.test.js | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/zipkin-lens/src/components/MiniTimeline/index.test.js b/zipkin-lens/src/components/MiniTimeline/index.test.js new file mode 100644 index 0000000..b8da922 --- /dev/null +++ b/zipkin-lens/src/components/MiniTimeline/index.test.js @@ -0,0 +1,73 @@ +import React from 'react'; +import { shallow } from 'enzyme'; + +import MiniTimeline from './index'; + +describe('', () => { + const commonProps = { + startTs: 0, + endTs: 10, + onStartAndEndTsChange: () => {}, + }; + + const dummySpan = { + spanId: '1', + spanName: 'span', + parentId: '2', + childIds: [], + serviceName: 'service', + serviceNames: [], + timestamp: 0, + duration: 10, + durationStr: '10μs', + tags: [], + annotations: [], + errorType: 'none', + depth: 1, + width: 1, + left: 1, + }; + + it('should return null if the number of spans is less than 2', () => { + let props = { + ...commonProps, + traceSummary: { + traceId: '12345', + spans: [], + serviceNameAndSpanCounts: [], + duration: 10, + durationStr: '10μs', + }, + }; + let wrapper = shallow(); + expect(wrapper.type()).toEqual(null); + + props = { + ...commonProps, + traceSummary: { + traceId: '12345', + spans: [dummySpan], + serviceNameAndSpanCounts: [], + duration: 10, + durationStr: '10μs', + }, + }; + wrapper = shallow(); + expect(wrapper.type()).toEqual(null); + }); + + it('should return mini timeline otherwise', () => { + const props = { + ...commonProps, + traceSummary: { + traceId: '12345', + spans: [dummySpan, dummySpan], + serviceNameAndSpanCounts: [], + duration: 10, + durationStr: '10μs', + }, + }; + const wrapper = shallow(); + expect(wrapper.find('.mini-timeline').length).toBe(1); + }); +});