mirror of https://github.com/apache/druid.git
Web-Console: Increase snapshot coverage (#8408)
* increase test-coverage * fix ordered inputs * fixes * prettier fix * fixes
This commit is contained in:
parent
4b69ce0f09
commit
beed07022a
|
@ -0,0 +1,198 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Segment Timeline matches snapshot 1`] = `
|
||||
<div
|
||||
class="segment-timeline app-view"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="loader"
|
||||
>
|
||||
<div
|
||||
class="loader-logo"
|
||||
>
|
||||
<svg
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
class="one"
|
||||
d="M54.2,69.8h-2.7c-0.7,0-1.3-0.6-1.3-1.3c0-0.7,0.6-1.3,1.3-1.3h2.7c11.5,0,23.8-7.4,23.8-23.7
|
||||
c0-9.1-6.9-15.8-16.4-15.8H38c-0.7,0-1.3-0.6-1.3-1.3s0.6-1.3,1.3-1.3h23.6c5.3,0,10.1,1.9,13.6,5.3c3.5,3.4,5.4,8,5.4,13.1
|
||||
c0,6.6-2.3,13-6.3,17.7C69.5,66.8,62.5,69.8,54.2,69.8z"
|
||||
/>
|
||||
<path
|
||||
class="two"
|
||||
d="M55.7,59.5h-26c-0.7,0-1.3-0.6-1.3-1.3c0-0.7,0.6-1.3,1.3-1.3h26c7.5,0,11.5-5.8,11.5-11.5
|
||||
c0-4.2-3.2-7.3-7.7-7.3h-26c-0.7,0-1.3-0.6-1.3-1.3s0.6-1.3,1.3-1.3h26c5.9,0,10.3,4.3,10.3,9.9c0,3.7-1.3,7.2-3.7,9.8
|
||||
C63.5,58,59.9,59.5,55.7,59.5z"
|
||||
/>
|
||||
<path
|
||||
class="three"
|
||||
d="M27.2,38h-6.3c-0.7,0-1.3-0.6-1.3-1.3s0.6-1.3,1.3-1.3h6.3c0.7,0,1.3,0.6,1.3,1.3S27.9,38,27.2,38z"
|
||||
/>
|
||||
<path
|
||||
class="four"
|
||||
d="M45.1,69.8h-5.8c-0.7,0-1.3-0.6-1.3-1.3c0-0.7,0.6-1.3,1.3-1.3h5.8c0.7,0,1.3,0.6,1.3,1.3
|
||||
C46.4,69.2,45.8,69.8,45.1,69.8z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="side-control"
|
||||
>
|
||||
<div
|
||||
class="bp3-form-group"
|
||||
>
|
||||
<div
|
||||
class="bp3-form-content"
|
||||
>
|
||||
<div>
|
||||
<label
|
||||
class="bp3-control bp3-radio"
|
||||
>
|
||||
<input
|
||||
checked=""
|
||||
name="Blueprint3.RadioGroup-0"
|
||||
type="radio"
|
||||
value="countData"
|
||||
/>
|
||||
<span
|
||||
class="bp3-control-indicator"
|
||||
/>
|
||||
Segment count
|
||||
</label>
|
||||
<label
|
||||
class="bp3-control bp3-radio"
|
||||
>
|
||||
<input
|
||||
name="Blueprint3.RadioGroup-0"
|
||||
type="radio"
|
||||
value="sizeData"
|
||||
/>
|
||||
<span
|
||||
class="bp3-control-indicator"
|
||||
/>
|
||||
Total size
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="bp3-form-group"
|
||||
>
|
||||
<label
|
||||
class="bp3-label"
|
||||
>
|
||||
Datasource:
|
||||
|
||||
<span
|
||||
class="bp3-text-muted"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
class="bp3-form-content"
|
||||
>
|
||||
<div
|
||||
class="bp3-html-select bp3-fill"
|
||||
>
|
||||
<select>
|
||||
<option
|
||||
value="all"
|
||||
>
|
||||
Show all
|
||||
</option>
|
||||
</select>
|
||||
<span
|
||||
class="bp3-icon bp3-icon-double-caret-vertical"
|
||||
icon="double-caret-vertical"
|
||||
>
|
||||
<svg
|
||||
data-icon="double-caret-vertical"
|
||||
height="16"
|
||||
viewBox="0 0 16 16"
|
||||
width="16"
|
||||
>
|
||||
<desc>
|
||||
double-caret-vertical
|
||||
</desc>
|
||||
<path
|
||||
d="M5 7h6a1.003 1.003 0 00.71-1.71l-3-3C8.53 2.11 8.28 2 8 2s-.53.11-.71.29l-3 3A1.003 1.003 0 005 7zm6 2H5a1.003 1.003 0 00-.71 1.71l3 3c.18.18.43.29.71.29s.53-.11.71-.29l3-3A1.003 1.003 0 0011 9z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="bp3-form-group"
|
||||
>
|
||||
<label
|
||||
class="bp3-label"
|
||||
>
|
||||
Period:
|
||||
|
||||
<span
|
||||
class="bp3-text-muted"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
class="bp3-form-content"
|
||||
>
|
||||
<div
|
||||
class="bp3-html-select bp3-fill"
|
||||
>
|
||||
<select>
|
||||
<option
|
||||
value="1"
|
||||
>
|
||||
1 months
|
||||
</option>
|
||||
<option
|
||||
value="3"
|
||||
>
|
||||
3 months
|
||||
</option>
|
||||
<option
|
||||
value="6"
|
||||
>
|
||||
6 months
|
||||
</option>
|
||||
<option
|
||||
value="9"
|
||||
>
|
||||
9 months
|
||||
</option>
|
||||
<option
|
||||
value="12"
|
||||
>
|
||||
1 year
|
||||
</option>
|
||||
</select>
|
||||
<span
|
||||
class="bp3-icon bp3-icon-double-caret-vertical"
|
||||
icon="double-caret-vertical"
|
||||
>
|
||||
<svg
|
||||
data-icon="double-caret-vertical"
|
||||
height="16"
|
||||
viewBox="0 0 16 16"
|
||||
width="16"
|
||||
>
|
||||
<desc>
|
||||
double-caret-vertical
|
||||
</desc>
|
||||
<path
|
||||
d="M5 7h6a1.003 1.003 0 00.71-1.71l-3-3C8.53 2.11 8.28 2 8 2s-.53.11-.71.29l-3 3A1.003 1.003 0 005 7zm6 2H5a1.003 1.003 0 00-.71 1.71l3 3c.18.18.43.29.71.29s.53-.11.71-.29l3-3A1.003 1.003 0 0011 9z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { SegmentTimeline } from './segment-timeline';
|
||||
|
||||
describe('Segment Timeline', () => {
|
||||
it('matches snapshot', () => {
|
||||
const tableColumn = <SegmentTimeline chartHeight={100} chartWidth={100} />;
|
||||
const { container } = render(tableColumn);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,44 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Timed button matches snapshot 1`] = `
|
||||
<div
|
||||
class="bp3-button-group"
|
||||
>
|
||||
<button
|
||||
class="bp3-button"
|
||||
type="button"
|
||||
/>
|
||||
<span
|
||||
class="bp3-popover-wrapper"
|
||||
>
|
||||
<span
|
||||
class="bp3-popover-target"
|
||||
>
|
||||
<button
|
||||
class="bp3-button"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
class="bp3-icon bp3-icon-caret-down"
|
||||
icon="caret-down"
|
||||
>
|
||||
<svg
|
||||
data-icon="caret-down"
|
||||
height="16"
|
||||
viewBox="0 0 16 16"
|
||||
width="16"
|
||||
>
|
||||
<desc>
|
||||
caret-down
|
||||
</desc>
|
||||
<path
|
||||
d="M12 6.5c0-.28-.22-.5-.5-.5h-7a.495.495 0 00-.37.83l3.5 4c.09.1.22.17.37.17s.28-.07.37-.17l3.5-4c.08-.09.13-.2.13-.33z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
`;
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { TimedButton } from './timed-button';
|
||||
|
||||
describe('Timed button', () => {
|
||||
it('matches snapshot', () => {
|
||||
const timedButton = (
|
||||
<TimedButton
|
||||
intervals={[{ label: 'timeValue', value: 1000 }]}
|
||||
onRefresh={() => null}
|
||||
label={'label'}
|
||||
defaultValue={1000}
|
||||
/>
|
||||
);
|
||||
const { container } = render(timedButton);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -16,6 +16,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { getSamplerType } from './sampler';
|
||||
import { computeFlattenExprsForData } from './spec-utils';
|
||||
|
||||
describe('spec-utils', () => {
|
||||
|
@ -66,3 +67,42 @@ describe('spec-utils', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('test-utils', () => {
|
||||
it('spec-utils', () => {
|
||||
expect(
|
||||
getSamplerType({
|
||||
type: 'index_parallel',
|
||||
ioConfig: {
|
||||
type: 'index_parallel',
|
||||
firehose: {
|
||||
type: 'http',
|
||||
uris: ['https://static.imply.io/data/wikipedia.json.gz'],
|
||||
},
|
||||
},
|
||||
tuningConfig: {
|
||||
type: 'index_parallel',
|
||||
},
|
||||
dataSchema: {
|
||||
dataSource: 'wikipedia',
|
||||
granularitySpec: {
|
||||
type: 'uniform',
|
||||
segmentGranularity: 'DAY',
|
||||
queryGranularity: 'HOUR',
|
||||
},
|
||||
parser: {
|
||||
type: 'string',
|
||||
parseSpec: {
|
||||
format: 'json',
|
||||
timestampSpec: {
|
||||
column: 'timestamp',
|
||||
format: 'iso',
|
||||
},
|
||||
dimensionsSpec: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toMatchInlineSnapshot(`"TRIM( TRAILING 'M' undefined 'MADAM')"`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,241 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { getDruidErrorMessage, parseHtmlError, parseQueryPlan } from './druid-query';
|
||||
import {
|
||||
getColumnTypeFromHeaderAndRows,
|
||||
getDimensionSpecs,
|
||||
getMetricSecs,
|
||||
guessTypeFromSample,
|
||||
updateSchemaWithSample,
|
||||
} from './druid-type';
|
||||
import { IngestionSpec } from './ingestion-spec';
|
||||
import {
|
||||
getSamplerType,
|
||||
headerFromSampleResponse,
|
||||
sampleForConnect,
|
||||
sampleForExampleManifests,
|
||||
sampleForFilter,
|
||||
sampleForParser,
|
||||
sampleForSchema,
|
||||
sampleForTimestamp,
|
||||
sampleForTransform,
|
||||
} from './sampler';
|
||||
|
||||
describe('test-utils', () => {
|
||||
const ingestionSpec = {
|
||||
type: 'index_parallel',
|
||||
ioConfig: {
|
||||
type: 'index_parallel',
|
||||
firehose: {
|
||||
type: 'http',
|
||||
uris: ['https://static.imply.io/data/wikipedia.json.gz'],
|
||||
},
|
||||
},
|
||||
tuningConfig: {
|
||||
type: 'index_parallel',
|
||||
},
|
||||
dataSchema: {
|
||||
dataSource: 'wikipedia',
|
||||
granularitySpec: {
|
||||
type: 'uniform',
|
||||
segmentGranularity: 'DAY',
|
||||
queryGranularity: 'HOUR',
|
||||
},
|
||||
parser: {
|
||||
type: 'string',
|
||||
parseSpec: {
|
||||
format: 'json',
|
||||
timestampSpec: {
|
||||
column: 'timestamp',
|
||||
format: 'iso',
|
||||
},
|
||||
dimensionsSpec: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
it('spec-utils getSamplerType', () => {
|
||||
expect(getSamplerType(ingestionSpec as IngestionSpec)).toMatchInlineSnapshot(`"index"`);
|
||||
});
|
||||
it('spec-utils headerFromSampleResponse', () => {
|
||||
expect(headerFromSampleResponse({ cacheKey: 'abc123', data: [] })).toMatchInlineSnapshot(
|
||||
`Array []`,
|
||||
);
|
||||
});
|
||||
it('spec-utils sampleForParser', () => {
|
||||
expect(
|
||||
sampleForParser(ingestionSpec as IngestionSpec, 'start', 'abc123'),
|
||||
).toMatchInlineSnapshot(`Promise {}`);
|
||||
});
|
||||
it('spec-utils SampleSpec', () => {
|
||||
expect(sampleForConnect(ingestionSpec as IngestionSpec, 'start')).toMatchInlineSnapshot(
|
||||
`Promise {}`,
|
||||
);
|
||||
});
|
||||
it('spec-utils sampleForTimestamp', () => {
|
||||
expect(
|
||||
sampleForTimestamp(ingestionSpec as IngestionSpec, 'start', 'abc123'),
|
||||
).toMatchInlineSnapshot(`Promise {}`);
|
||||
});
|
||||
it('spec-utils sampleForTransform', () => {
|
||||
expect(
|
||||
sampleForTransform(ingestionSpec as IngestionSpec, 'start', 'abc123'),
|
||||
).toMatchInlineSnapshot(`Promise {}`);
|
||||
});
|
||||
it('spec-utils sampleForFilter', () => {
|
||||
expect(
|
||||
sampleForFilter(ingestionSpec as IngestionSpec, 'start', 'abc123'),
|
||||
).toMatchInlineSnapshot(`Promise {}`);
|
||||
});
|
||||
it('spec-utils sampleForSchema', () => {
|
||||
expect(
|
||||
sampleForSchema(ingestionSpec as IngestionSpec, 'start', 'abc123'),
|
||||
).toMatchInlineSnapshot(`Promise {}`);
|
||||
});
|
||||
it('spec-utils sampleForExampleManifests', () => {
|
||||
expect(sampleForExampleManifests('abc123')).toMatchInlineSnapshot(`Promise {}`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('druid-type.ts', () => {
|
||||
const ingestionSpec = {
|
||||
type: 'index_parallel',
|
||||
ioConfig: {
|
||||
type: 'index_parallel',
|
||||
firehose: {
|
||||
type: 'http',
|
||||
uris: ['https://static.imply.io/data/wikipedia.json.gz'],
|
||||
},
|
||||
},
|
||||
tuningConfig: {
|
||||
type: 'index_parallel',
|
||||
},
|
||||
dataSchema: {
|
||||
dataSource: 'wikipedia',
|
||||
granularitySpec: {
|
||||
type: 'uniform',
|
||||
segmentGranularity: 'DAY',
|
||||
queryGranularity: 'HOUR',
|
||||
},
|
||||
parser: {
|
||||
type: 'string',
|
||||
parseSpec: {
|
||||
format: 'json',
|
||||
timestampSpec: {
|
||||
column: 'timestamp',
|
||||
format: 'iso',
|
||||
},
|
||||
dimensionsSpec: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
it('spec-utils getSamplerType', () => {
|
||||
expect(guessTypeFromSample([])).toMatchInlineSnapshot(`"string"`);
|
||||
});
|
||||
it('spec-utils getColumnTypeFromHeaderAndRows', () => {
|
||||
expect(
|
||||
getColumnTypeFromHeaderAndRows({ header: ['header'], rows: [] }, 'header'),
|
||||
).toMatchInlineSnapshot(`"string"`);
|
||||
});
|
||||
it('spec-utils getDimensionSpecs', () => {
|
||||
expect(getDimensionSpecs({ header: ['header'], rows: [] }, true)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"header",
|
||||
]
|
||||
`);
|
||||
});
|
||||
it('spec-utils getMetricSecs', () => {
|
||||
expect(getMetricSecs({ header: ['header'], rows: [] })).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
"name": "count",
|
||||
"type": "count",
|
||||
},
|
||||
]
|
||||
`);
|
||||
});
|
||||
it('spec-utils updateSchemaWithSample', () => {
|
||||
expect(
|
||||
updateSchemaWithSample(
|
||||
ingestionSpec as IngestionSpec,
|
||||
{ header: ['header'], rows: [] },
|
||||
'specific',
|
||||
true,
|
||||
),
|
||||
).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"dataSchema": Object {
|
||||
"dataSource": "wikipedia",
|
||||
"granularitySpec": Object {
|
||||
"queryGranularity": "HOUR",
|
||||
"rollup": true,
|
||||
"segmentGranularity": "DAY",
|
||||
"type": "uniform",
|
||||
},
|
||||
"metricsSpec": Array [
|
||||
Object {
|
||||
"name": "count",
|
||||
"type": "count",
|
||||
},
|
||||
],
|
||||
"parser": Object {
|
||||
"parseSpec": Object {
|
||||
"dimensionsSpec": Object {
|
||||
"dimensions": Array [
|
||||
"header",
|
||||
],
|
||||
},
|
||||
"format": "json",
|
||||
"timestampSpec": Object {
|
||||
"column": "timestamp",
|
||||
"format": "iso",
|
||||
},
|
||||
},
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
"ioConfig": Object {
|
||||
"firehose": Object {
|
||||
"type": "http",
|
||||
"uris": Array [
|
||||
"https://static.imply.io/data/wikipedia.json.gz",
|
||||
],
|
||||
},
|
||||
"type": "index_parallel",
|
||||
},
|
||||
"tuningConfig": Object {
|
||||
"type": "index_parallel",
|
||||
},
|
||||
"type": "index_parallel",
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
||||
describe('druid-query.ts', () => {
|
||||
it('spec-utils parseHtmlError', () => {
|
||||
expect(parseHtmlError('<div></div>')).toMatchInlineSnapshot(`undefined`);
|
||||
});
|
||||
it('spec-utils parseHtmlError', () => {
|
||||
expect(getDruidErrorMessage({})).toMatchInlineSnapshot(`undefined`);
|
||||
});
|
||||
it('spec-utils parseQueryPlan', () => {
|
||||
expect(parseQueryPlan('start')).toMatchInlineSnapshot(`"start"`);
|
||||
});
|
||||
});
|
File diff suppressed because it is too large
Load Diff
|
@ -17,14 +17,77 @@
|
|||
*/
|
||||
|
||||
import { render } from '@testing-library/react';
|
||||
import { sqlParserFactory } from 'druid-query-toolkit';
|
||||
import React from 'react';
|
||||
|
||||
import { SQL_FUNCTIONS } from '../../../../lib/sql-docs';
|
||||
|
||||
import { QueryOutput } from './query-output';
|
||||
|
||||
describe('query output', () => {
|
||||
it('matches snapshot', () => {
|
||||
const parser = sqlParserFactory(SQL_FUNCTIONS.map(sqlFunction => sqlFunction.name));
|
||||
|
||||
const parsedQuery = parser(`SELECT
|
||||
"language",
|
||||
COUNT(*) AS "Count", COUNT(DISTINCT "language") AS "dist_language", COUNT(*) FILTER (WHERE "language"= 'xxx') AS "language_filtered_count"
|
||||
FROM "github"
|
||||
WHERE "__time" >= CURRENT_TIMESTAMP - INTERVAL '1' DAY AND "language" != 'TypeScript'
|
||||
GROUP BY 1
|
||||
HAVING "Count" != 37392
|
||||
ORDER BY "Count" DESC`);
|
||||
|
||||
const queryOutput = (
|
||||
<QueryOutput runeMode={false} onQueryChange={() => {}} loading={false} error="lol" />
|
||||
<QueryOutput
|
||||
runeMode={false}
|
||||
loading={false}
|
||||
error="lol"
|
||||
queryResult={{
|
||||
header: ['language', 'Count', 'dist_language', 'language_filtered_count'],
|
||||
rows: [
|
||||
['', 6881, 1, 0],
|
||||
['JavaScript', 166, 1, 0],
|
||||
['Python', 62, 1, 0],
|
||||
['HTML', 46, 1, 0],
|
||||
['Java', 42, 1, 0],
|
||||
['C++', 28, 1, 0],
|
||||
['Go', 24, 1, 0],
|
||||
['Ruby', 20, 1, 0],
|
||||
['C#', 14, 1, 0],
|
||||
['C', 13, 1, 0],
|
||||
['CSS', 13, 1, 0],
|
||||
['Shell', 12, 1, 0],
|
||||
['Makefile', 10, 1, 0],
|
||||
['PHP', 9, 1, 0],
|
||||
['Scala', 8, 1, 0],
|
||||
['HCL', 6, 1, 0],
|
||||
['Jupyter Notebook', 6, 1, 0],
|
||||
['Smarty', 4, 1, 0],
|
||||
['Elm', 4, 1, 0],
|
||||
['Roff', 3, 1, 0],
|
||||
['Dockerfile', 3, 1, 0],
|
||||
['Rust', 3, 1, 0],
|
||||
['Dart', 2, 1, 0],
|
||||
['LLVM', 2, 1, 0],
|
||||
['Objective-C', 2, 1, 0],
|
||||
['Julia', 2, 1, 0],
|
||||
['PowerShell', 2, 1, 0],
|
||||
['Swift', 2, 1, 0],
|
||||
['Nim', 2, 1, 0],
|
||||
['XSLT', 1, 1, 0],
|
||||
['Lua', 1, 1, 0],
|
||||
['Vim script', 1, 1, 0],
|
||||
['Vue', 1, 1, 0],
|
||||
['Lasso', 1, 1, 0],
|
||||
['Clojure', 1, 1, 0],
|
||||
['OCaml', 1, 1, 0],
|
||||
['Chapel', 1, 1, 0],
|
||||
['Kotlin', 1, 1, 0],
|
||||
],
|
||||
}}
|
||||
parsedQuery={parsedQuery}
|
||||
onQueryChange={() => null}
|
||||
/>
|
||||
);
|
||||
|
||||
const { container } = render(queryOutput);
|
||||
|
|
|
@ -93,6 +93,7 @@ export class QueryOutput extends React.PureComponent<QueryOutputProps> {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
getHeaderActions(h: string) {
|
||||
const { parsedQuery, onQueryChange, runeMode } = this.props;
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Visualization BarUnit 1`] = `
|
||||
<rect
|
||||
class="bar-chart-unit"
|
||||
height="10"
|
||||
width="10"
|
||||
x="10"
|
||||
y="10"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Visualization action barGroup 1`] = `
|
||||
<g
|
||||
class="chart-axis undefined"
|
||||
transform="value"
|
||||
/>
|
||||
`;
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { BarUnit } from './bar-unit';
|
||||
import { ChartAxis } from './chart-axis';
|
||||
|
||||
describe('Visualization', () => {
|
||||
it('BarUnit', () => {
|
||||
const barGroup = <BarUnit x={10} y={10} width={10} height={10} />;
|
||||
const { container } = render(barGroup);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
it('action barGroup', () => {
|
||||
const barGroup = <ChartAxis transform={'value'} scale={() => null} />;
|
||||
const { container } = render(barGroup);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue