+`;
diff --git a/web-console/src/components/segment-timeline/segment-timeline.spec.tsx b/web-console/src/components/segment-timeline/segment-timeline.spec.tsx
new file mode 100644
index 00000000000..6d13e435c4d
--- /dev/null
+++ b/web-console/src/components/segment-timeline/segment-timeline.spec.tsx
@@ -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 = ;
+ const { container } = render(tableColumn);
+ expect(container.firstChild).toMatchSnapshot();
+ });
+});
diff --git a/web-console/src/components/timed-button/__snapshots__/timed-button.spec.tsx.snap b/web-console/src/components/timed-button/__snapshots__/timed-button.spec.tsx.snap
new file mode 100644
index 00000000000..97e0b8ca77b
--- /dev/null
+++ b/web-console/src/components/timed-button/__snapshots__/timed-button.spec.tsx.snap
@@ -0,0 +1,44 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Timed button matches snapshot 1`] = `
+
+
+
+
+
+
+
+
+`;
diff --git a/web-console/src/components/timed-button/timed-button.spec.tsx b/web-console/src/components/timed-button/timed-button.spec.tsx
new file mode 100644
index 00000000000..2de48117a17
--- /dev/null
+++ b/web-console/src/components/timed-button/timed-button.spec.tsx
@@ -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 = (
+ null}
+ label={'label'}
+ defaultValue={1000}
+ />
+ );
+ const { container } = render(timedButton);
+ expect(container.firstChild).toMatchSnapshot();
+ });
+});
diff --git a/web-console/src/utils/spec-utils.spec.ts b/web-console/src/utils/spec-utils.spec.ts
index f3684173b76..c55a46eba29 100644
--- a/web-console/src/utils/spec-utils.spec.ts
+++ b/web-console/src/utils/spec-utils.spec.ts
@@ -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')"`);
+ });
+});
diff --git a/web-console/src/utils/utils.spec.ts b/web-console/src/utils/utils.spec.ts
new file mode 100644
index 00000000000..dda3c73b3ae
--- /dev/null
+++ b/web-console/src/utils/utils.spec.ts
@@ -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('')).toMatchInlineSnapshot(`undefined`);
+ });
+ it('spec-utils parseHtmlError', () => {
+ expect(getDruidErrorMessage({})).toMatchInlineSnapshot(`undefined`);
+ });
+ it('spec-utils parseQueryPlan', () => {
+ expect(parseQueryPlan('start')).toMatchInlineSnapshot(`"start"`);
+ });
+});
diff --git a/web-console/src/views/query-view/query-output/__snapshots__/query-output.spec.tsx.snap b/web-console/src/views/query-view/query-output/__snapshots__/query-output.spec.tsx.snap
index 65e36a818c6..e5a679fa368 100644
--- a/web-console/src/views/query-view/query-output/__snapshots__/query-output.spec.tsx.snap
+++ b/web-console/src/views/query-view/query-output/__snapshots__/query-output.spec.tsx.snap
@@ -13,196 +13,1711 @@ exports[`query output matches snapshot 1`] = `
>