mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
chore(NA): move canvas plugin tests out of __tests__ folder (#87519)
* chore(NA): move canvas plugin tests out of __tests__ folder * chore(NA): fix types import on fixtures * chore(NA): rename helpers to test_helpers Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
3b602f8668
commit
693775ce03
91 changed files with 308 additions and 316 deletions
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functions as browserFns } from '../../canvas_plugin_src/functions/browser';
|
||||
import { ExpressionFunction } from '../../../../../src/plugins/expressions';
|
||||
import { initFunctions } from '../../public/functions';
|
||||
import { functions as browserFns } from '../canvas_plugin_src/functions/browser';
|
||||
import { ExpressionFunction } from '../../../../src/plugins/expressions';
|
||||
import { initFunctions } from '../public/functions';
|
||||
|
||||
export const functionSpecs = browserFns
|
||||
.concat(...(initFunctions({} as any) as any))
|
|
@ -3,7 +3,7 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { CanvasWorkpad, CanvasElement, CanvasPage, CanvasVariable } from '../../types';
|
||||
import { CanvasWorkpad, CanvasElement, CanvasPage, CanvasVariable } from '../types';
|
||||
|
||||
const BaseWorkpad: CanvasWorkpad = {
|
||||
'@created': '2019-02-08T18:35:23.029Z',
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { testTable } from '../common/__tests__/fixtures/test_tables';
|
||||
import { fontStyle } from '../common/__tests__/fixtures/test_styles';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { testTable } from '../common/__fixtures__/test_tables';
|
||||
import { fontStyle } from '../common/__fixtures__/test_styles';
|
||||
import { markdown } from './markdown';
|
||||
|
||||
describe('markdown', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { elasticLogo } from '../../../../lib/elastic_logo';
|
||||
import { elasticLogo } from '../../../lib/elastic_logo';
|
||||
|
||||
export const fontStyle = {
|
||||
type: 'style',
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Datatable } from '../../../../../types';
|
||||
import { Datatable } from '../../../../types';
|
||||
|
||||
const emptyTable: Datatable = {
|
||||
type: 'datatable',
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { compare } from '../compare';
|
||||
import { functionWrapper } from '../../../../__tests__/helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../../i18n';
|
||||
|
||||
const errors = getFunctionErrors().compare;
|
||||
|
||||
describe('compare', () => {
|
||||
const fn = functionWrapper(compare);
|
||||
|
||||
describe('args', () => {
|
||||
describe('op', () => {
|
||||
it('sets the operator', () => {
|
||||
expect(fn(0, { op: 'lt', to: 1 })).to.be(true);
|
||||
});
|
||||
|
||||
it("defaults to 'eq'", () => {
|
||||
expect(fn(0, { to: 1 })).to.be(false);
|
||||
expect(fn(0, { to: 0 })).to.be(true);
|
||||
});
|
||||
|
||||
it('throws when invalid op is provided', () => {
|
||||
expect(() => fn(1, { op: 'boo', to: 2 })).to.throwException(
|
||||
new RegExp(errors.invalidCompareOperator('boo').message)
|
||||
);
|
||||
expect(() => fn(1, { op: 'boo' })).to.throwException(
|
||||
new RegExp(errors.invalidCompareOperator('boo').message)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('to', () => {
|
||||
it('sets the value that context is compared to', () => {
|
||||
expect(fn(0, { to: 1 })).to.be(false);
|
||||
});
|
||||
|
||||
it('if not provided, ne returns true while every other operator returns false', () => {
|
||||
expect(fn(null, { op: 'ne' })).to.be(true);
|
||||
expect(fn(0, { op: 'ne' })).to.be(true);
|
||||
expect(fn(true, { op: 'lte' })).to.be(false);
|
||||
expect(fn(1, { op: 'gte' })).to.be(false);
|
||||
expect(fn('foo', { op: 'lt' })).to.be(false);
|
||||
expect(fn(null, { op: 'gt' })).to.be(false);
|
||||
expect(fn(null, { op: 'eq' })).to.be(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('same type comparisons', () => {
|
||||
describe('null', () => {
|
||||
it('returns true', () => {
|
||||
expect(fn(null, { op: 'eq', to: null })).to.be(true);
|
||||
expect(fn(null, { op: 'lte', to: null })).to.be(true);
|
||||
expect(fn(null, { op: 'gte', to: null })).to.be(true);
|
||||
});
|
||||
|
||||
it('returns false', () => {
|
||||
expect(fn(null, { op: 'ne', to: null })).to.be(false);
|
||||
expect(fn(null, { op: 'lt', to: null })).to.be(false);
|
||||
expect(fn(null, { op: 'gt', to: null })).to.be(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('number', () => {
|
||||
it('returns true', () => {
|
||||
expect(fn(-2.34, { op: 'lt', to: 10 })).to.be(true);
|
||||
expect(fn(2, { op: 'gte', to: 2 })).to.be(true);
|
||||
});
|
||||
|
||||
it('returns false', () => {
|
||||
expect(fn(2, { op: 'eq', to: 10 })).to.be(false);
|
||||
expect(fn(10, { op: 'ne', to: 10 })).to.be(false);
|
||||
expect(fn(1, { op: 'lte', to: -3 })).to.be(false);
|
||||
expect(fn(2, { op: 'gt', to: 2 })).to.be(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('string', () => {
|
||||
it('returns true', () => {
|
||||
expect(fn('foo', { op: 'gte', to: 'foo' })).to.be(true);
|
||||
expect(fn('foo', { op: 'lte', to: 'foo' })).to.be(true);
|
||||
expect(fn('bar', { op: 'lt', to: 'foo' })).to.be(true);
|
||||
});
|
||||
|
||||
it('returns false', () => {
|
||||
expect(fn('foo', { op: 'eq', to: 'bar' })).to.be(false);
|
||||
expect(fn('foo', { op: 'ne', to: 'foo' })).to.be(false);
|
||||
expect(fn('foo', { op: 'gt', to: 'foo' })).to.be(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('boolean', () => {
|
||||
it('returns true', () => {
|
||||
expect(fn(true, { op: 'eq', to: true })).to.be(true);
|
||||
expect(fn(false, { op: 'eq', to: false })).to.be(true);
|
||||
expect(fn(true, { op: 'ne', to: false })).to.be(true);
|
||||
expect(fn(false, { op: 'ne', to: true })).to.be(true);
|
||||
});
|
||||
it('returns false', () => {
|
||||
expect(fn(true, { op: 'eq', to: false })).to.be(false);
|
||||
expect(fn(false, { op: 'eq', to: true })).to.be(false);
|
||||
expect(fn(true, { op: 'ne', to: true })).to.be(false);
|
||||
expect(fn(false, { op: 'ne', to: false })).to.be(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('different type comparisons', () => {
|
||||
it("returns true for 'ne' only", () => {
|
||||
expect(fn(0, { op: 'ne', to: '0' })).to.be(true);
|
||||
});
|
||||
|
||||
it('otherwise always returns false', () => {
|
||||
expect(fn(0, { op: 'eq', to: '0' })).to.be(false);
|
||||
expect(fn('foo', { op: 'lt', to: 10 })).to.be(false);
|
||||
expect(fn('foo', { op: 'lte', to: true })).to.be(false);
|
||||
expect(fn(0, { op: 'gte', to: null })).to.be(false);
|
||||
expect(fn(0, { op: 'eq', to: false })).to.be(false);
|
||||
expect(fn(true, { op: 'gte', to: null })).to.be(false);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { all } from './all';
|
||||
|
||||
describe('all', () => {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { emptyTable, testTable } from './__tests__/fixtures/test_tables';
|
||||
import { emptyTable, testTable } from './__fixtures__/test_tables';
|
||||
import { alterColumn } from './alterColumn';
|
||||
|
||||
const errors = getFunctionErrors().alterColumn;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { any } from './any';
|
||||
|
||||
describe('any', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { asFn } from './as';
|
||||
|
||||
describe('as', () => {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { testTable } from './__tests__/fixtures/test_tables';
|
||||
import { testTable } from './__fixtures__/test_tables';
|
||||
import { axisConfig } from './axisConfig';
|
||||
|
||||
const errors = getFunctionErrors().axisConfig;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { caseFn } from './case';
|
||||
|
||||
describe('case', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { testTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { testTable } from './__fixtures__/test_tables';
|
||||
import { clear } from './clear';
|
||||
|
||||
describe('clear', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { emptyTable, testTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { emptyTable, testTable } from './__fixtures__/test_tables';
|
||||
import { columns } from './columns';
|
||||
|
||||
describe('columns', () => {
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { compare } from './compare';
|
||||
|
||||
const errors = getFunctionErrors().compare;
|
||||
|
||||
describe('compare', () => {
|
||||
const fn = functionWrapper(compare);
|
||||
|
||||
describe('args', () => {
|
||||
describe('op', () => {
|
||||
it('sets the operator', () => {
|
||||
expect(fn(0, { op: 'lt', to: 1 })).toBe(true);
|
||||
});
|
||||
|
||||
it("defaults to 'eq'", () => {
|
||||
expect(fn(0, { to: 1 })).toBe(false);
|
||||
expect(fn(0, { to: 0 })).toBe(true);
|
||||
});
|
||||
|
||||
it('throws when invalid op is provided', () => {
|
||||
expect(() => fn(1, { op: 'boo', to: 2 })).toThrowError(
|
||||
new RegExp(errors.invalidCompareOperator('boo').message)
|
||||
);
|
||||
expect(() => fn(1, { op: 'boo' })).toThrowError(
|
||||
new RegExp(errors.invalidCompareOperator('boo').message)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('to', () => {
|
||||
it('sets the value that context is compared to', () => {
|
||||
expect(fn(0, { to: 1 })).toBe(false);
|
||||
});
|
||||
|
||||
it('if not provided, ne returns true while every other operator returns false', () => {
|
||||
expect(fn(null, { op: 'ne' })).toBe(true);
|
||||
expect(fn(0, { op: 'ne' })).toBe(true);
|
||||
expect(fn(true, { op: 'lte' })).toBe(false);
|
||||
expect(fn(1, { op: 'gte' })).toBe(false);
|
||||
expect(fn('foo', { op: 'lt' })).toBe(false);
|
||||
expect(fn(null, { op: 'gt' })).toBe(false);
|
||||
expect(fn(null, { op: 'eq' })).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('same type comparisons', () => {
|
||||
describe('null', () => {
|
||||
it('returns true', () => {
|
||||
expect(fn(null, { op: 'eq', to: null })).toBe(true);
|
||||
expect(fn(null, { op: 'lte', to: null })).toBe(true);
|
||||
expect(fn(null, { op: 'gte', to: null })).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false', () => {
|
||||
expect(fn(null, { op: 'ne', to: null })).toBe(false);
|
||||
expect(fn(null, { op: 'lt', to: null })).toBe(false);
|
||||
expect(fn(null, { op: 'gt', to: null })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('number', () => {
|
||||
it('returns true', () => {
|
||||
expect(fn(-2.34, { op: 'lt', to: 10 })).toBe(true);
|
||||
expect(fn(2, { op: 'gte', to: 2 })).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false', () => {
|
||||
expect(fn(2, { op: 'eq', to: 10 })).toBe(false);
|
||||
expect(fn(10, { op: 'ne', to: 10 })).toBe(false);
|
||||
expect(fn(1, { op: 'lte', to: -3 })).toBe(false);
|
||||
expect(fn(2, { op: 'gt', to: 2 })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('string', () => {
|
||||
it('returns true', () => {
|
||||
expect(fn('foo', { op: 'gte', to: 'foo' })).toBe(true);
|
||||
expect(fn('foo', { op: 'lte', to: 'foo' })).toBe(true);
|
||||
expect(fn('bar', { op: 'lt', to: 'foo' })).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false', () => {
|
||||
expect(fn('foo', { op: 'eq', to: 'bar' })).toBe(false);
|
||||
expect(fn('foo', { op: 'ne', to: 'foo' })).toBe(false);
|
||||
expect(fn('foo', { op: 'gt', to: 'foo' })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('boolean', () => {
|
||||
it('returns true', () => {
|
||||
expect(fn(true, { op: 'eq', to: true })).toBe(true);
|
||||
expect(fn(false, { op: 'eq', to: false })).toBe(true);
|
||||
expect(fn(true, { op: 'ne', to: false })).toBe(true);
|
||||
expect(fn(false, { op: 'ne', to: true })).toBe(true);
|
||||
});
|
||||
it('returns false', () => {
|
||||
expect(fn(true, { op: 'eq', to: false })).toBe(false);
|
||||
expect(fn(false, { op: 'eq', to: true })).toBe(false);
|
||||
expect(fn(true, { op: 'ne', to: true })).toBe(false);
|
||||
expect(fn(false, { op: 'ne', to: false })).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('different type comparisons', () => {
|
||||
it("returns true for 'ne' only", () => {
|
||||
expect(fn(0, { op: 'ne', to: '0' })).toBe(true);
|
||||
});
|
||||
|
||||
it('otherwise always returns false', () => {
|
||||
expect(fn(0, { op: 'eq', to: '0' })).toBe(false);
|
||||
expect(fn('foo', { op: 'lt', to: 10 })).toBe(false);
|
||||
expect(fn('foo', { op: 'lte', to: true })).toBe(false);
|
||||
expect(fn(0, { op: 'gte', to: null })).toBe(false);
|
||||
expect(fn(0, { op: 'eq', to: false })).toBe(false);
|
||||
expect(fn(true, { op: 'gte', to: null })).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { elasticLogo } from '../../lib/elastic_logo';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { containerStyle } from './containerStyle';
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { testTable, emptyTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { testTable, emptyTable } from './__fixtures__/test_tables';
|
||||
import { context } from './context';
|
||||
|
||||
describe('context', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { csv } from './csv';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import sinon from 'sinon';
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { date } from './date';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { doFn } from './do';
|
||||
|
||||
describe('do', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { testTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { testTable } from './__fixtures__/test_tables';
|
||||
import { dropdownControl } from './dropdownControl';
|
||||
|
||||
describe('dropdownControl', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { eq } from './eq';
|
||||
|
||||
describe('eq', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { emptyFilter } from './__tests__/fixtures/test_filters';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { emptyFilter } from './__fixtures__/test_filters';
|
||||
import { exactly } from './exactly';
|
||||
|
||||
describe('exactly', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { testTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { testTable } from './__fixtures__/test_tables';
|
||||
import { filterrows } from './filterrows';
|
||||
|
||||
const inStock = (datatable) => datatable.rows[0].in_stock;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { formatdate } from './formatdate';
|
||||
|
||||
describe('formatdate', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { formatnumber } from './formatnumber';
|
||||
|
||||
describe('formatnumber', () => {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { emptyTable, testTable } from './__tests__/fixtures/test_tables';
|
||||
import { emptyTable, testTable } from './__fixtures__/test_tables';
|
||||
import { getCell } from './getCell';
|
||||
|
||||
const errors = getFunctionErrors().getCell;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { gt } from './gt';
|
||||
|
||||
describe('gt', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { gte } from './gte';
|
||||
|
||||
describe('gte', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { emptyTable, testTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { emptyTable, testTable } from './__fixtures__/test_tables';
|
||||
import { head } from './head';
|
||||
|
||||
describe('head', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { ifFn } from './if';
|
||||
|
||||
describe('if', () => {
|
||||
|
|
|
@ -5,13 +5,15 @@
|
|||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { image } from '../image';
|
||||
import { functionWrapper } from '../../../../__tests__/helpers/function_wrapper';
|
||||
import { elasticLogo } from '../../../lib/elastic_logo';
|
||||
import { elasticOutline } from '../../../lib/elastic_outline';
|
||||
// import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { elasticLogo } from '../../lib/elastic_logo';
|
||||
import { elasticOutline } from '../../lib/elastic_outline';
|
||||
// import { image } from './image';
|
||||
|
||||
describe('image', () => {
|
||||
const fn = functionWrapper(image);
|
||||
// TODO: the test was not running and is not up to date
|
||||
describe.skip('image', () => {
|
||||
// const fn = functionWrapper(image);
|
||||
const fn = jest.fn();
|
||||
|
||||
it('returns an image object using a dataUrl', () => {
|
||||
const result = fn(null, { dataurl: elasticOutline, mode: 'cover' });
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { testTable } from './__tests__/fixtures/test_tables';
|
||||
import { testTable } from './__fixtures__/test_tables';
|
||||
import { joinRows } from './join_rows';
|
||||
|
||||
const errors = getFunctionErrors().joinRows;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { lt } from './lt';
|
||||
|
||||
describe('lt', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { lte } from './lte';
|
||||
|
||||
describe('lte', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { testTable, emptyTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { testTable, emptyTable } from './__fixtures__/test_tables';
|
||||
import { mapColumn } from './mapColumn';
|
||||
|
||||
const pricePlusTwo = (datatable) => Promise.resolve(datatable.rows[0].price + 2);
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { emptyTable, testTable } from './__tests__/fixtures/test_tables';
|
||||
import { emptyTable, testTable } from './__fixtures__/test_tables';
|
||||
import { math } from './math';
|
||||
|
||||
const errors = getFunctionErrors().math;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { fontStyle } from './__tests__/fixtures/test_styles';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { fontStyle } from './__fixtures__/test_styles';
|
||||
import { metric } from './metric';
|
||||
|
||||
describe('metric', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { neq } from './neq';
|
||||
|
||||
describe('neq', () => {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { testTable } from './__tests__/fixtures/test_tables';
|
||||
import { testTable } from './__fixtures__/test_tables';
|
||||
import { ply } from './ply';
|
||||
|
||||
const errors = getFunctionErrors().ply;
|
||||
|
|
|
@ -5,14 +5,15 @@
|
|||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { progress } from '../progress';
|
||||
import { functionWrapper } from '../../../../__tests__/helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../../i18n';
|
||||
import { fontStyle } from './fixtures/test_styles';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { progress } from './progress';
|
||||
import { fontStyle } from './__fixtures__/test_styles';
|
||||
|
||||
const errors = getFunctionErrors().progress;
|
||||
|
||||
describe('progress', () => {
|
||||
// TODO: this test was not running and is not up to date
|
||||
describe.skip('progress', () => {
|
||||
const fn = functionWrapper(progress);
|
||||
const value = 0.33;
|
||||
|
|
@ -4,10 +4,10 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { DEFAULT_ELEMENT_CSS } from '../../../common/lib/constants';
|
||||
import { testTable } from './__tests__/fixtures/test_tables';
|
||||
import { fontStyle, containerStyle } from './__tests__/fixtures/test_styles';
|
||||
import { testTable } from './__fixtures__/test_tables';
|
||||
import { fontStyle, containerStyle } from './__fixtures__/test_styles';
|
||||
import { render } from './render';
|
||||
|
||||
const renderTable = {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { elasticOutline } from '../../lib/elastic_outline';
|
||||
import { elasticLogo } from '../../lib/elastic_logo';
|
||||
import { repeatImage } from './repeat_image';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { replace } from './replace';
|
||||
|
||||
describe('replace', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { elasticOutline } from '../../lib/elastic_outline';
|
||||
import { elasticLogo } from '../../lib/elastic_logo';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { rounddate } from './rounddate';
|
||||
|
||||
describe('rounddate', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { emptyTable, testTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { emptyTable, testTable } from './__fixtures__/test_tables';
|
||||
import { rowCount } from './rowCount';
|
||||
|
||||
describe('rowCount', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { seriesStyle } from './seriesStyle';
|
||||
|
||||
describe('seriesStyle', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { testTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { testTable } from './__fixtures__/test_tables';
|
||||
import { sort } from './sort';
|
||||
|
||||
describe('sort', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { testTable, emptyTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { testTable, emptyTable } from './__fixtures__/test_tables';
|
||||
import { staticColumn } from './staticColumn';
|
||||
|
||||
describe('staticColumn', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { string } from './string';
|
||||
|
||||
describe('string', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { switchFn } from './switch';
|
||||
|
||||
describe('switch', () => {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { testTable } from './__tests__/fixtures/test_tables';
|
||||
import { fontStyle } from './__tests__/fixtures/test_styles';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { testTable } from './__fixtures__/test_tables';
|
||||
import { fontStyle } from './__fixtures__/test_styles';
|
||||
import { table } from './table';
|
||||
|
||||
describe('table', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { emptyTable, testTable } from './__tests__/fixtures/test_tables';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { emptyTable, testTable } from './__fixtures__/test_tables';
|
||||
import { tail } from './tail';
|
||||
|
||||
describe('tail', () => {
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
*/
|
||||
|
||||
import sinon from 'sinon';
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { getFunctionErrors } from '../../../i18n';
|
||||
import { emptyFilter } from './__tests__/fixtures/test_filters';
|
||||
import { emptyFilter } from './__fixtures__/test_filters';
|
||||
import { timefilter } from './timefilter';
|
||||
|
||||
const errors = getFunctionErrors().timefilter;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
|
||||
import { functionWrapper } from '../../../test_helpers/function_wrapper';
|
||||
import { timefilterControl } from './timefilterControl';
|
||||
|
||||
describe('timefilterControl', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { emptyTable, testTable } from '../common/__tests__/fixtures/test_tables';
|
||||
import { emptyTable, testTable } from '../common/__fixtures__/test_tables';
|
||||
import { getExpressionType } from './pointseries/lib/get_expression_type';
|
||||
|
||||
describe('getExpressionType', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { emptyTable, testTable } from '../common/__tests__/fixtures/test_tables';
|
||||
import { emptyTable, testTable } from '../common/__fixtures__/test_tables';
|
||||
import { pointseries } from './pointseries';
|
||||
|
||||
describe('pointseries', () => {
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { getFormObject } from '../get_form_object';
|
||||
|
||||
describe('getFormObject', () => {
|
||||
describe('valid input', () => {
|
||||
it('string', () => {
|
||||
expect(getFormObject('field')).to.be.eql({ fn: '', column: 'field' });
|
||||
});
|
||||
it('simple expression', () => {
|
||||
expect(getFormObject('mean(field)')).to.be.eql({ fn: 'mean', column: 'field' });
|
||||
});
|
||||
});
|
||||
describe('invalid input', () => {
|
||||
it('number', () => {
|
||||
expect(getFormObject)
|
||||
.withArgs('2')
|
||||
.to.throwException((e) => {
|
||||
expect(e.message).to.be('Cannot render scalar values or complex math expressions');
|
||||
});
|
||||
});
|
||||
it('complex expression', () => {
|
||||
expect(getFormObject)
|
||||
.withArgs('mean(field * 3)')
|
||||
.to.throwException((e) => {
|
||||
expect(e.message).to.be('Cannot render scalar values or complex math expressions');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { getFormObject } from './get_form_object';
|
||||
|
||||
describe('getFormObject', () => {
|
||||
describe('valid input', () => {
|
||||
it('string', () => {
|
||||
expect(getFormObject('field')).toEqual({ fn: '', column: 'field' });
|
||||
});
|
||||
it('simple expression', () => {
|
||||
expect(getFormObject('mean(field)')).toEqual({ fn: 'mean', column: 'field' });
|
||||
});
|
||||
});
|
||||
describe('invalid input', () => {
|
||||
it('number', () => {
|
||||
expect(() => {
|
||||
getFormObject('2');
|
||||
}).toThrow('Cannot render scalar values or complex math expressions');
|
||||
});
|
||||
it('complex expression', () => {
|
||||
expect(() => {
|
||||
getFormObject('mean(field * 3)');
|
||||
}).toThrow('Cannot render scalar values or complex math expressions');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionSpecs } from '../../__tests__/fixtures/function_specs';
|
||||
import { functionSpecs } from '../../__fixtures__/function_specs';
|
||||
|
||||
import {
|
||||
FunctionSuggestion,
|
||||
|
@ -17,7 +17,7 @@ describe('autocomplete', () => {
|
|||
it('should return function definition for plot', () => {
|
||||
const expression = 'plot ';
|
||||
const def = getFnArgDefAtPosition(functionSpecs, expression, expression.length);
|
||||
const plotFn = functionSpecs.find((spec) => spec.name === 'plot');
|
||||
const plotFn = functionSpecs.find((spec: any) => spec.name === 'plot');
|
||||
expect(def.fnDef).toBe(plotFn);
|
||||
});
|
||||
});
|
||||
|
@ -33,7 +33,7 @@ describe('autocomplete', () => {
|
|||
it('should suggest arguments', () => {
|
||||
const expression = 'plot ';
|
||||
const suggestions = getAutocompleteSuggestions(functionSpecs, expression, expression.length);
|
||||
const plotFn = functionSpecs.find((spec) => spec.name === 'plot');
|
||||
const plotFn = functionSpecs.find((spec: any) => spec.name === 'plot');
|
||||
expect(suggestions.length).toBe(Object.keys(plotFn!.args).length);
|
||||
expect(suggestions[0].start).toBe(expression.length);
|
||||
expect(suggestions[0].end).toBe(expression.length);
|
||||
|
@ -42,7 +42,7 @@ describe('autocomplete', () => {
|
|||
it('should suggest values', () => {
|
||||
const expression = 'shape shape=';
|
||||
const suggestions = getAutocompleteSuggestions(functionSpecs, expression, expression.length);
|
||||
const shapeFn = functionSpecs.find((spec) => spec.name === 'shape');
|
||||
const shapeFn = functionSpecs.find((spec: any) => spec.name === 'shape');
|
||||
expect(suggestions.length).toBe(shapeFn!.args.shape.options.length);
|
||||
expect(suggestions[0].start).toBe(expression.length);
|
||||
expect(suggestions[0].end).toBe(expression.length);
|
||||
|
@ -110,7 +110,7 @@ describe('autocomplete', () => {
|
|||
expression,
|
||||
expression.length - 1
|
||||
);
|
||||
const ltFn = functionSpecs.find((spec) => spec.name === 'lt');
|
||||
const ltFn = functionSpecs.find((spec: any) => spec.name === 'lt');
|
||||
expect(suggestions.length).toBe(Object.keys(ltFn!.args).length);
|
||||
expect(suggestions[0].start).toBe(expression.length - 1);
|
||||
expect(suggestions[0].end).toBe(expression.length - 1);
|
||||
|
@ -123,7 +123,7 @@ describe('autocomplete', () => {
|
|||
expression,
|
||||
expression.length - 1
|
||||
);
|
||||
const shapeFn = functionSpecs.find((spec) => spec.name === 'shape');
|
||||
const shapeFn = functionSpecs.find((spec: any) => spec.name === 'shape');
|
||||
expect(suggestions.length).toBe(shapeFn!.args.shape.options.length);
|
||||
expect(suggestions[0].start).toBe(expression.length - 1);
|
||||
expect(suggestions[0].end).toBe(expression.length - 1);
|
||||
|
@ -136,7 +136,7 @@ describe('autocomplete', () => {
|
|||
expression,
|
||||
expression.length - 1
|
||||
);
|
||||
const shapeFn = functionSpecs.find((spec) => spec.name === 'shape');
|
||||
const shapeFn = functionSpecs.find((spec: any) => spec.name === 'shape');
|
||||
expect(suggestions.length).toBe(shapeFn!.args.shape.options.length);
|
||||
expect(suggestions[0].start).toBe(expression.length - '"ar"'.length);
|
||||
expect(suggestions[0].end).toBe(expression.length);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import {
|
||||
emptyTable,
|
||||
testTable,
|
||||
} from '../../canvas_plugin_src/functions/common/__tests__/fixtures/test_tables';
|
||||
} from '../../canvas_plugin_src/functions/common/__fixtures__/test_tables';
|
||||
import { getFieldType } from './get_field_type';
|
||||
|
||||
describe('getFieldType', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { testTable } from '../../canvas_plugin_src/functions/common/__tests__/fixtures/test_tables';
|
||||
import { testTable } from '../../canvas_plugin_src/functions/common/__fixtures__/test_tables';
|
||||
import { Handlebars } from './handlebars';
|
||||
|
||||
describe('handlebars', () => {
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { ExportApp } from '../export_app.component';
|
||||
import { CanvasWorkpad } from '../../../../../types';
|
||||
import { ExportApp } from './export_app.component';
|
||||
import { CanvasWorkpad } from '../../../../types';
|
||||
|
||||
jest.mock('style-it', () => ({
|
||||
it: (css: string, Component: any) => Component,
|
||||
}));
|
||||
|
||||
jest.mock('../../../../components/workpad_page', () => ({
|
||||
jest.mock('../../../components/workpad_page', () => ({
|
||||
WorkpadPage: (props: any) => <div>Page</div>,
|
||||
}));
|
||||
|
||||
jest.mock('../../../../components/link', () => ({
|
||||
jest.mock('../../../components/link', () => ({
|
||||
Link: (props: any) => <div>Link</div>,
|
||||
}));
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { render } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { Download } from '..';
|
||||
import { Download } from '.';
|
||||
|
||||
describe('<Download />', () => {
|
||||
test('has canvasDownload class', () => {
|
|
@ -7,7 +7,7 @@
|
|||
jest.mock('../../../../common/lib/fetch');
|
||||
|
||||
import { getPdfUrl, createPdf, LayoutType } from './utils';
|
||||
import { workpads } from '../../../../__tests__/fixtures/workpads';
|
||||
import { workpads } from '../../../../__fixtures__/workpads';
|
||||
import { fetch } from '../../../../common/lib/fetch';
|
||||
import { IBasePath } from 'kibana/public';
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../__tests__/helpers/function_wrapper';
|
||||
import { testPie } from '../../canvas_plugin_src/functions/common/__tests__/fixtures/test_pointseries';
|
||||
import { functionWrapper } from '../../test_helpers/function_wrapper';
|
||||
import { testPie } from '../../canvas_plugin_src/functions/common/__fixtures__/test_pointseries';
|
||||
import {
|
||||
fontStyle,
|
||||
grayscalePalette,
|
||||
seriesStyle,
|
||||
} from '../../canvas_plugin_src/functions/common/__tests__/fixtures/test_styles';
|
||||
} from '../../canvas_plugin_src/functions/common/__fixtures__/test_styles';
|
||||
import { pieFunctionFactory } from './pie';
|
||||
|
||||
describe('pie', () => {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { functionWrapper } from '../../__tests__/helpers/function_wrapper';
|
||||
import { testPlot } from '../../canvas_plugin_src/functions/common/__tests__/fixtures/test_pointseries';
|
||||
import { functionWrapper } from '../../test_helpers/function_wrapper';
|
||||
import { testPlot } from '../../canvas_plugin_src/functions/common/__fixtures__/test_pointseries';
|
||||
import {
|
||||
fontStyle,
|
||||
grayscalePalette,
|
||||
|
@ -13,7 +13,7 @@ import {
|
|||
xAxisConfig,
|
||||
seriesStyle,
|
||||
defaultStyle,
|
||||
} from '../../canvas_plugin_src/functions/common/__tests__/fixtures/test_styles';
|
||||
} from '../../canvas_plugin_src/functions/common/__fixtures__/test_styles';
|
||||
import { plotFunctionFactory } from './plot';
|
||||
|
||||
describe('plot', () => {
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
xAxisConfig,
|
||||
yAxisConfig,
|
||||
hideAxis,
|
||||
} from '../../../canvas_plugin_src/functions/common/__tests__/fixtures/test_styles';
|
||||
} from '../../../canvas_plugin_src/functions/common/__fixtures__/test_styles';
|
||||
import { getFlotAxisConfig } from './get_flot_axis_config';
|
||||
|
||||
describe('getFlotAxisConfig', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { fontStyle } from '../../../canvas_plugin_src/functions/common/__tests__/fixtures/test_styles';
|
||||
import { fontStyle } from '../../../canvas_plugin_src/functions/common/__fixtures__/test_styles';
|
||||
import { defaultSpec, getFontSpec } from './get_font_spec';
|
||||
|
||||
describe('getFontSpec', () => {
|
||||
|
|
|
@ -8,7 +8,7 @@ jest.mock('../../../../../src/plugins/kibana_utils/public');
|
|||
import { Storage } from '../../../../../src/plugins/kibana_utils/public';
|
||||
import { setClipboardData, getClipboardData } from './clipboard';
|
||||
import { LOCALSTORAGE_CLIPBOARD } from '../../common/lib/constants';
|
||||
import { elements } from '../../__tests__/fixtures/workpads';
|
||||
import { elements } from '../../__fixtures__/workpads';
|
||||
|
||||
const set = jest.fn();
|
||||
const get = jest.fn();
|
||||
|
|
|
@ -4,13 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import {
|
||||
inFlightActive,
|
||||
inFlightComplete,
|
||||
setLoading,
|
||||
setValue,
|
||||
} from '../../actions/resolved_args';
|
||||
import { inFlightMiddlewareFactory } from '../in_flight';
|
||||
import { inFlightActive, inFlightComplete, setLoading, setValue } from '../actions/resolved_args';
|
||||
import { inFlightMiddlewareFactory } from './in_flight';
|
||||
|
||||
const next = jest.fn();
|
||||
const dispatch = jest.fn();
|
|
@ -4,14 +4,14 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
jest.mock('../../../lib/app_state');
|
||||
jest.mock('../../../lib/router_provider');
|
||||
jest.mock('../../lib/app_state');
|
||||
jest.mock('../../lib/router_provider');
|
||||
|
||||
import { workpadAutoplay } from '../workpad_autoplay';
|
||||
import { setAutoplayInterval } from '../../../lib/app_state';
|
||||
import { createTimeInterval } from '../../../lib/time_interval';
|
||||
import { workpadAutoplay } from './workpad_autoplay';
|
||||
import { setAutoplayInterval } from '../../lib/app_state';
|
||||
import { createTimeInterval } from '../../lib/time_interval';
|
||||
// @ts-expect-error untyped local
|
||||
import { routerProvider } from '../../../lib/router_provider';
|
||||
import { routerProvider } from '../../lib/router_provider';
|
||||
|
||||
const next = jest.fn();
|
||||
const dispatch = jest.fn();
|
|
@ -4,14 +4,14 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
jest.mock('../../../lib/app_state');
|
||||
jest.mock('../../lib/app_state');
|
||||
|
||||
import { workpadRefresh } from '../workpad_refresh';
|
||||
import { inFlightComplete } from '../../actions/resolved_args';
|
||||
import { setRefreshInterval } from '../../actions/workpad';
|
||||
import { setRefreshInterval as setAppStateRefreshInterval } from '../../../lib/app_state';
|
||||
import { workpadRefresh } from './workpad_refresh';
|
||||
import { inFlightComplete } from '../actions/resolved_args';
|
||||
import { setRefreshInterval } from '../actions/workpad';
|
||||
import { setRefreshInterval as setAppStateRefreshInterval } from '../../lib/app_state';
|
||||
|
||||
import { createTimeInterval } from '../../../lib/time_interval';
|
||||
import { createTimeInterval } from '../../lib/time_interval';
|
||||
|
||||
const next = jest.fn();
|
||||
const dispatch = jest.fn();
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { summarizeWorkpads } from './workpad_collector';
|
||||
import { workpads } from '../../__tests__/fixtures/workpads';
|
||||
import { workpads } from '../../__fixtures__/workpads';
|
||||
|
||||
describe('usage collector handle es response data', () => {
|
||||
it('should summarize workpads, pages, and elements', () => {
|
||||
|
|
|
@ -8,7 +8,7 @@ import { CANVAS_TYPE } from '../../../common/lib/constants';
|
|||
import { initializeGetWorkpadRoute } from './get';
|
||||
import { kibanaResponseFactory, RequestHandlerContext, RequestHandler } from 'src/core/server';
|
||||
import { savedObjectsClientMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { workpadWithGroupAsElement } from '../../../__tests__/fixtures/workpads';
|
||||
import { workpadWithGroupAsElement } from '../../../__fixtures__/workpads';
|
||||
import { CanvasWorkpad } from '../../../types';
|
||||
import { getMockedRouterDeps } from '../test_helpers';
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import { CANVAS_TYPE } from '../../../common/lib/constants';
|
|||
import { initializeUpdateWorkpadRoute, initializeUpdateWorkpadAssetsRoute } from './update';
|
||||
import { kibanaResponseFactory, RequestHandlerContext, RequestHandler } from 'src/core/server';
|
||||
import { savedObjectsClientMock, httpServerMock } from 'src/core/server/mocks';
|
||||
import { workpads } from '../../../__tests__/fixtures/workpads';
|
||||
import { workpads } from '../../../__fixtures__/workpads';
|
||||
import { okResponse } from '../ok_response';
|
||||
import { getMockedRouterDeps } from '../test_helpers';
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { sharedWorkpads, tick } from '../../test';
|
||||
import { share } from '../shareable';
|
||||
import { sharedWorkpads, tick } from '../test';
|
||||
import { share } from './shareable';
|
||||
|
||||
// Mock the renderers within this test.
|
||||
jest.mock('../../supported_renderers');
|
||||
jest.mock('../supported_renderers');
|
||||
|
||||
describe('Canvas Shareable Workpad API', () => {
|
||||
// Mock the AJAX load of the workpad.
|
|
@ -13,8 +13,8 @@
|
|||
import { mount, ReactWrapper } from 'enzyme';
|
||||
import React from 'react';
|
||||
// import { act } from 'react-dom/test-utils';
|
||||
import { App } from '../app';
|
||||
import { sharedWorkpads, WorkpadNames, tick } from '../../test';
|
||||
import { App } from './app';
|
||||
import { sharedWorkpads, WorkpadNames, tick } from '../test';
|
||||
import {
|
||||
getScrubber as scrubber,
|
||||
getScrubberSlideContainer as scrubberContainer,
|
||||
|
@ -27,11 +27,11 @@ import {
|
|||
getFooter as footer,
|
||||
getPageControlsPrevious as previous,
|
||||
getPageControlsNext as next,
|
||||
} from '../../test/selectors';
|
||||
import { openSettings, selectMenuItem } from '../../test/interactions';
|
||||
} from '../test/selectors';
|
||||
import { openSettings, selectMenuItem } from '../test/interactions';
|
||||
|
||||
// Mock the renderers
|
||||
jest.mock('../../supported_renderers');
|
||||
jest.mock('../supported_renderers');
|
||||
|
||||
// Mock the EuiPortal - `insertAdjacentElement is not supported in
|
||||
// `jsdom` 12. We're just going to render a `div` with the children
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
import { mount, ReactWrapper } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { JestContext } from '../../test/context_jest';
|
||||
import { getScrubber as scrubber, getPageControlsCenter as center } from '../../test/selectors';
|
||||
import { Canvas } from '../canvas';
|
||||
import { JestContext } from '../test/context_jest';
|
||||
import { getScrubber as scrubber, getPageControlsCenter as center } from '../test/selectors';
|
||||
import { Canvas } from './canvas';
|
||||
|
||||
jest.mock('../../supported_renderers');
|
||||
jest.mock('../supported_renderers');
|
||||
|
||||
describe('<Canvas />', () => {
|
||||
test('null workpad renders nothing', () => {
|
|
@ -10,7 +10,7 @@ import { storiesOf } from '@storybook/react';
|
|||
import { CanvasRenderedPage } from '../../../types';
|
||||
import { ExampleContext } from '../../../test/context_example';
|
||||
import { Scrubber, ScrubberComponent } from '../scrubber';
|
||||
import { workpads } from '../../../../__tests__/fixtures/workpads';
|
||||
import { workpads } from '../../../../__fixtures__/workpads';
|
||||
|
||||
storiesOf('shareables/Footer/Scrubber', module)
|
||||
.add('contextual: hello', () => (
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { Page } from '../page';
|
||||
import { Page } from './page';
|
||||
|
||||
describe('<Page />', () => {
|
||||
test('null workpad renders nothing', () => {
|
Loading…
Add table
Add a link
Reference in a new issue