Skip to content

Commit

Permalink
WIP refactor trace, test maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffon committed Aug 20, 2017
1 parent 401b083 commit c34bbd3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
28 changes: 28 additions & 0 deletions src/components/App/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import React from 'react';
import { shallow } from 'enzyme';

import JaegerUIApp from './index';

it('JaegerUIApp does not explode', () => {
shallow(<JaegerUIApp />);
});
17 changes: 5 additions & 12 deletions src/index.test.js → src/components/DependencyGraph/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import JaegerUIApp, { TracePage, SearchTracePage } from './index';
import React from 'react';
import { shallow } from 'enzyme';

/* eslint-disable global-require, import/newline-after-import */
it('JaegerUIApp should be exported as default', () => {
expect(JaegerUIApp).toBe(require('../src/components/App').default);
});

it('TracePage should be exported as as a named export', () => {
expect(TracePage).toBe(require('../src/components/TracePage').default);
});
import DependencyGraphPage from './index';

it('SearchTracePage should be exported as a named export', () => {
expect(SearchTracePage).toBe(require('../src/components/SearchTracePage').SearchTracePage);
it('DependencyGraphPage does not explode', () => {
shallow(<DependencyGraphPage fetchDependencies={() => {}} />);
});
/* eslint-enable global-require, import/newline-after-import */
14 changes: 5 additions & 9 deletions src/selectors/trace.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import _values from 'lodash/values';
import setsEqual from 'sets-equal';

import traceGenerator from '../../src/demo/trace-generators';
Expand Down Expand Up @@ -158,15 +159,10 @@ it('getSpanDepthForTrace() should determine the depth of a given span in the par
});

it('getTraceServices() should return an unique array of all services in the trace', () => {
expect(
setsEqual(
new Set(traceSelectors.getTraceServices(generatedTrace)),
generatedTrace.spans.reduce(
(results, { processID }) => results.add(generatedTrace.processes[processID].serviceName),
new Set()
)
)
).toBeTruthy();
const svcs = [...traceSelectors.getTraceServices(generatedTrace)].sort();
const set = new Set(_values(generatedTrace.processes).map(v => v.serviceName));
const setSvcs = [...set.values()].sort();
expect(svcs).toEqual(setSvcs);
});

it('getTraceServiceCount() should return the length of the service list', () => {
Expand Down

0 comments on commit c34bbd3

Please sign in to comment.