diff --git a/test/_macros.js b/test/_macros.js index 71c0bf0c..5d40476e 100644 --- a/test/_macros.js +++ b/test/_macros.js @@ -100,7 +100,7 @@ export function simpleExpect(keyName, propValue) { * @param {Object} defaultDef * @returns {function} */ -export function aggsExpectStrategy(name, type, defaultDef) { +export function nameTypeExpectStrategy(name, type, defaultDef) { return (keyName, propValue) => ({ [name]: { [type]: Object.assign({ [keyName]: propValue }, defaultDef) diff --git a/test/aggregations-test/adjacency-matrix-agg.test.js b/test/aggregations-test/adjacency-matrix-agg.test.js index 0b1bfbfa..a96b2734 100644 --- a/test/aggregations-test/adjacency-matrix-agg.test.js +++ b/test/aggregations-test/adjacency-matrix-agg.test.js @@ -1,12 +1,12 @@ import test from 'ava'; import { AdjacencyMatrixAggregation, termQuery } from '../../src'; -import { illegalCall, setsAggType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { illegalCall, setsAggType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = () => new AdjacencyMatrixAggregation('my_adj_mat_agg'); const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_adj_mat_agg', 'adjacency_matrix') + nameTypeExpectStrategy('my_adj_mat_agg', 'adjacency_matrix') ); const filterQryA = termQuery('user', 'kimchy'); diff --git a/test/aggregations-test/bucket-agg-base.test.js b/test/aggregations-test/bucket-agg-base.test.js index 3b6b6a77..2c2310f2 100644 --- a/test/aggregations-test/bucket-agg-base.test.js +++ b/test/aggregations-test/bucket-agg-base.test.js @@ -1,11 +1,11 @@ import test from 'ava'; import { Script } from '../../src'; import { BucketAggregationBase } from '../../src/aggregations/bucket-aggregations'; -import { illegalParamType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { illegalParamType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = (...args) => new BucketAggregationBase('my_agg', 'my_type', ...args); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'my_type')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'my_type')); test('can be instantiated', t => { t.truthy(getInstance()); diff --git a/test/aggregations-test/bucket-script-agg.test.js b/test/aggregations-test/bucket-script-agg.test.js index d17f52b5..8a6a168a 100644 --- a/test/aggregations-test/bucket-script-agg.test.js +++ b/test/aggregations-test/bucket-script-agg.test.js @@ -1,10 +1,13 @@ import test from 'ava'; import { BucketScriptAggregation, Script } from '../../src'; -import { setsAggType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = bucketsPath => new BucketScriptAggregation('my_agg', bucketsPath); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'bucket_script')); +const setsOption = makeSetsOptionMacro( + getInstance, + nameTypeExpectStrategy('my_agg', 'bucket_script') +); test(setsAggType, BucketScriptAggregation, 'bucket_script'); test(setsOption, 'script', { param: 'params.my_var1 / params.my_var2' }); diff --git a/test/aggregations-test/bucket-selector-agg.test.js b/test/aggregations-test/bucket-selector-agg.test.js index 91610d70..97e737bd 100644 --- a/test/aggregations-test/bucket-selector-agg.test.js +++ b/test/aggregations-test/bucket-selector-agg.test.js @@ -1,12 +1,12 @@ import test from 'ava'; import { BucketSelectorAggregation, Script } from '../../src'; -import { setsAggType, illegalCall, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, illegalCall, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = bucketsPath => new BucketSelectorAggregation('my_agg', bucketsPath); const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_agg', 'bucket_selector') + nameTypeExpectStrategy('my_agg', 'bucket_selector') ); test(setsAggType, BucketSelectorAggregation, 'bucket_selector'); diff --git a/test/aggregations-test/cardinality-agg.test.js b/test/aggregations-test/cardinality-agg.test.js index abdc8f1a..8346a34e 100644 --- a/test/aggregations-test/cardinality-agg.test.js +++ b/test/aggregations-test/cardinality-agg.test.js @@ -1,10 +1,13 @@ import test from 'ava'; import { CardinalityAggregation } from '../../src'; -import { setsAggType, illegalCall, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, illegalCall, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = field => new CardinalityAggregation('my_agg', field); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'cardinality')); +const setsOption = makeSetsOptionMacro( + getInstance, + nameTypeExpectStrategy('my_agg', 'cardinality') +); test(setsAggType, CardinalityAggregation, 'cardinality'); test(illegalCall, CardinalityAggregation, 'format', 'my_agg'); diff --git a/test/aggregations-test/derivative-agg.test.js b/test/aggregations-test/derivative-agg.test.js index 51c113a8..23a32b7f 100644 --- a/test/aggregations-test/derivative-agg.test.js +++ b/test/aggregations-test/derivative-agg.test.js @@ -1,10 +1,10 @@ import test from 'ava'; import { DerivativeAggregation } from '../../src'; -import { setsAggType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = bucketsPath => new DerivativeAggregation('my_agg', bucketsPath); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'derivative')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'derivative')); test(setsAggType, DerivativeAggregation, 'derivative'); test(setsOption, 'unit', { param: 'day' }); diff --git a/test/aggregations-test/diversified-sampler-agg.test.js b/test/aggregations-test/diversified-sampler-agg.test.js index 2dd7f0db..7d3e812c 100644 --- a/test/aggregations-test/diversified-sampler-agg.test.js +++ b/test/aggregations-test/diversified-sampler-agg.test.js @@ -3,7 +3,7 @@ import { DiversifiedSamplerAggregation } from '../../src'; import { setsAggType, validatedCorrectly, - aggsExpectStrategy, + nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; @@ -11,7 +11,7 @@ const getInstance = () => new DiversifiedSamplerAggregation('my_samples', 'my_fi const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_samples', 'diversified_sampler', { + nameTypeExpectStrategy('my_samples', 'diversified_sampler', { field: 'my_field' }) ); diff --git a/test/aggregations-test/extended-stats-agg.test.js b/test/aggregations-test/extended-stats-agg.test.js index d4c493fd..263438bd 100644 --- a/test/aggregations-test/extended-stats-agg.test.js +++ b/test/aggregations-test/extended-stats-agg.test.js @@ -1,10 +1,13 @@ import test from 'ava'; import { ExtendedStatsAggregation } from '../../src'; -import { setsAggType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = field => new ExtendedStatsAggregation('my_agg', field); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'extended_stats')); +const setsOption = makeSetsOptionMacro( + getInstance, + nameTypeExpectStrategy('my_agg', 'extended_stats') +); test(setsAggType, ExtendedStatsAggregation, 'extended_stats'); test(setsOption, 'sigma', { param: 3 }); diff --git a/test/aggregations-test/extended-stats-bucket-agg.test.js b/test/aggregations-test/extended-stats-bucket-agg.test.js index 9d1c99eb..5ef8faac 100644 --- a/test/aggregations-test/extended-stats-bucket-agg.test.js +++ b/test/aggregations-test/extended-stats-bucket-agg.test.js @@ -1,12 +1,12 @@ import test from 'ava'; import { ExtendedStatsBucketAggregation } from '../../src'; -import { setsAggType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = bucketsPath => new ExtendedStatsBucketAggregation('my_agg', bucketsPath); const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_agg', 'extended_stats_bucket') + nameTypeExpectStrategy('my_agg', 'extended_stats_bucket') ); test(setsAggType, ExtendedStatsBucketAggregation, 'extended_stats_bucket'); diff --git a/test/aggregations-test/filters-agg.test.js b/test/aggregations-test/filters-agg.test.js index 02a820fd..6a4672f0 100644 --- a/test/aggregations-test/filters-agg.test.js +++ b/test/aggregations-test/filters-agg.test.js @@ -5,7 +5,7 @@ import { illegalCall, illegalParamType, setsAggType, - aggsExpectStrategy, + nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; @@ -13,7 +13,7 @@ const getInstance = (...args) => new FiltersAggregation('my_filters_agg', ...arg const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_filters_agg', 'filters') + nameTypeExpectStrategy('my_filters_agg', 'filters') ); const filterQryA = termQuery('user', 'kimchy'); diff --git a/test/aggregations-test/geo-bounds-agg.test.js b/test/aggregations-test/geo-bounds-agg.test.js index 85d43ad8..daf4d839 100644 --- a/test/aggregations-test/geo-bounds-agg.test.js +++ b/test/aggregations-test/geo-bounds-agg.test.js @@ -1,10 +1,10 @@ import test from 'ava'; import { GeoBoundsAggregation } from '../../src'; -import { setsAggType, illegalCall, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, illegalCall, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = field => new GeoBoundsAggregation('my_agg', field); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'geo_bounds')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'geo_bounds')); test(setsAggType, GeoBoundsAggregation, 'geo_bounds'); test(illegalCall, GeoBoundsAggregation, 'format', 'my_agg'); diff --git a/test/aggregations-test/geo-distance-agg.test.js b/test/aggregations-test/geo-distance-agg.test.js index d3e0ec53..2d2f810b 100644 --- a/test/aggregations-test/geo-distance-agg.test.js +++ b/test/aggregations-test/geo-distance-agg.test.js @@ -3,7 +3,7 @@ import { GeoDistanceAggregation, geoPoint } from '../../src'; import { illegalCall, illegalParamType, - aggsExpectStrategy, + nameTypeExpectStrategy, makeSetsOptionMacro, validatedCorrectly } from '../_macros'; @@ -13,7 +13,7 @@ const getInstance = () => new GeoDistanceAggregation('my_geo_agg').range({ to: 1 const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_geo_agg', 'geo_distance', { + nameTypeExpectStrategy('my_geo_agg', 'geo_distance', { ranges: [{ to: 100 }] }) ); diff --git a/test/aggregations-test/geo-hash-grid-agg.test.js b/test/aggregations-test/geo-hash-grid-agg.test.js index 223cc01a..649d21e7 100644 --- a/test/aggregations-test/geo-hash-grid-agg.test.js +++ b/test/aggregations-test/geo-hash-grid-agg.test.js @@ -1,12 +1,12 @@ import test from 'ava'; import { GeoHashGridAggregation } from '../../src'; -import { illegalCall, setsAggType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { illegalCall, setsAggType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = () => new GeoHashGridAggregation('my_geo_agg'); const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_geo_agg', 'geohash_grid') + nameTypeExpectStrategy('my_geo_agg', 'geohash_grid') ); test(setsAggType, GeoHashGridAggregation, 'geohash_grid'); diff --git a/test/aggregations-test/histogram-agg-base.test.js b/test/aggregations-test/histogram-agg-base.test.js index 5afa46ac..1663d5fe 100644 --- a/test/aggregations-test/histogram-agg-base.test.js +++ b/test/aggregations-test/histogram-agg-base.test.js @@ -1,10 +1,10 @@ import test from 'ava'; import { HistogramAggregationBase } from '../../src/aggregations/bucket-aggregations'; -import { aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = (...args) => new HistogramAggregationBase('my_agg', 'my_type', ...args); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'my_type')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'my_type')); test(setsOption, 'interval', { param: 'year' }); test(setsOption, 'format', { param: '####.00' }); diff --git a/test/aggregations-test/matrix-stats-agg.test.js b/test/aggregations-test/matrix-stats-agg.test.js index 8b395f90..9a53b019 100644 --- a/test/aggregations-test/matrix-stats-agg.test.js +++ b/test/aggregations-test/matrix-stats-agg.test.js @@ -1,10 +1,18 @@ import test from 'ava'; import { MatrixStatsAggregation } from '../../src'; -import { setsAggType, illegalParamType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { + setsAggType, + illegalParamType, + nameTypeExpectStrategy, + makeSetsOptionMacro +} from '../_macros'; const getInstance = fields => new MatrixStatsAggregation('my_agg', fields); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'matrix_stats')); +const setsOption = makeSetsOptionMacro( + getInstance, + nameTypeExpectStrategy('my_agg', 'matrix_stats') +); test(setsAggType, MatrixStatsAggregation, 'matrix_stats'); test(illegalParamType, getInstance(), 'fields', 'Array'); diff --git a/test/aggregations-test/metrics-agg-base.test.js b/test/aggregations-test/metrics-agg-base.test.js index 6e27afd5..c0f5797c 100644 --- a/test/aggregations-test/metrics-agg-base.test.js +++ b/test/aggregations-test/metrics-agg-base.test.js @@ -1,11 +1,11 @@ import test from 'ava'; import { Script } from '../../src'; import { MetricsAggregationBase } from '../../src/aggregations/metrics-aggregations'; -import { illegalParamType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { illegalParamType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = field => new MetricsAggregationBase('my_agg', 'my_type', field); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'my_type')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'my_type')); test('can be instantiated', t => { t.truthy(getInstance()); diff --git a/test/aggregations-test/moving-average-agg.test.js b/test/aggregations-test/moving-average-agg.test.js index 04afd68c..fc6bb3fc 100644 --- a/test/aggregations-test/moving-average-agg.test.js +++ b/test/aggregations-test/moving-average-agg.test.js @@ -4,13 +4,13 @@ import { setsAggType, illegalCall, validatedCorrectly, - aggsExpectStrategy, + nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = bucketsPath => new MovingAverageAggregation('my_agg', bucketsPath); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'moving_avg')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'moving_avg')); test(setsAggType, MovingAverageAggregation, 'moving_avg'); test(illegalCall, MovingAverageAggregation, 'format', 'my_agg'); diff --git a/test/aggregations-test/nested-agg.test.js b/test/aggregations-test/nested-agg.test.js index d33a00b8..3a80ea19 100644 --- a/test/aggregations-test/nested-agg.test.js +++ b/test/aggregations-test/nested-agg.test.js @@ -1,10 +1,10 @@ import test from 'ava'; import { NestedAggregation } from '../../src'; -import { setsAggType, illegalCall, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, illegalCall, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = (...args) => new NestedAggregation('my_agg', ...args); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'nested')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'nested')); test(setsAggType, NestedAggregation, 'nested'); test(illegalCall, NestedAggregation, 'field', 'my_agg'); diff --git a/test/aggregations-test/percentile-ranks-agg.test.js b/test/aggregations-test/percentile-ranks-agg.test.js index 7271b699..3f15696b 100644 --- a/test/aggregations-test/percentile-ranks-agg.test.js +++ b/test/aggregations-test/percentile-ranks-agg.test.js @@ -4,7 +4,7 @@ import { setsAggType, illegalCall, illegalParamType, - aggsExpectStrategy, + nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; @@ -12,7 +12,7 @@ const getInstance = (field, values) => new PercentileRanksAggregation('my_agg', const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_agg', 'percentile_ranks') + nameTypeExpectStrategy('my_agg', 'percentile_ranks') ); test(setsAggType, PercentileRanksAggregation, 'percentile_ranks'); diff --git a/test/aggregations-test/percentiles-agg.test.js b/test/aggregations-test/percentiles-agg.test.js index 01641dcf..f4cb5141 100644 --- a/test/aggregations-test/percentiles-agg.test.js +++ b/test/aggregations-test/percentiles-agg.test.js @@ -1,10 +1,18 @@ import test from 'ava'; import { PercentilesAggregation } from '../../src'; -import { setsAggType, illegalParamType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { + setsAggType, + illegalParamType, + nameTypeExpectStrategy, + makeSetsOptionMacro +} from '../_macros'; const getInstance = field => new PercentilesAggregation('my_agg', field); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'percentiles')); +const setsOption = makeSetsOptionMacro( + getInstance, + nameTypeExpectStrategy('my_agg', 'percentiles') +); test(setsAggType, PercentilesAggregation, 'percentiles'); test(illegalParamType, getInstance(), 'percents', 'Array'); diff --git a/test/aggregations-test/percentiles-bucket-agg.test.js b/test/aggregations-test/percentiles-bucket-agg.test.js index e13e49f9..6b81e264 100644 --- a/test/aggregations-test/percentiles-bucket-agg.test.js +++ b/test/aggregations-test/percentiles-bucket-agg.test.js @@ -1,12 +1,17 @@ import test from 'ava'; import { PercentilesBucketAggregation } from '../../src'; -import { setsAggType, illegalParamType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { + setsAggType, + illegalParamType, + nameTypeExpectStrategy, + makeSetsOptionMacro +} from '../_macros'; const getInstance = bucketsPath => new PercentilesBucketAggregation('my_agg', bucketsPath); const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_agg', 'percentiles_bucket') + nameTypeExpectStrategy('my_agg', 'percentiles_bucket') ); test(setsAggType, PercentilesBucketAggregation, 'percentiles_bucket'); diff --git a/test/aggregations-test/pipeline-agg-base.test.js b/test/aggregations-test/pipeline-agg-base.test.js index 9dae5df6..1920c0e8 100644 --- a/test/aggregations-test/pipeline-agg-base.test.js +++ b/test/aggregations-test/pipeline-agg-base.test.js @@ -1,11 +1,11 @@ import test from 'ava'; import { PipelineAggregationBase } from '../../src/aggregations/pipeline-aggregations'; -import { validatedCorrectly, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { validatedCorrectly, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = bucketsPath => new PipelineAggregationBase('my_agg', 'my_type', '', bucketsPath); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'my_type')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'my_type')); test(validatedCorrectly, getInstance, 'gapPolicy', ['skip', 'insert_zeros']); test(setsOption, 'bucketsPath', { param: 'my_buckets_path' }); diff --git a/test/aggregations-test/range-agg-base.test.js b/test/aggregations-test/range-agg-base.test.js index d15fa152..108de92b 100644 --- a/test/aggregations-test/range-agg-base.test.js +++ b/test/aggregations-test/range-agg-base.test.js @@ -1,13 +1,13 @@ import test from 'ava'; import { RangeAggregationBase } from '../../src/aggregations/bucket-aggregations'; -import { illegalParamType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { illegalParamType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = (...args) => new RangeAggregationBase('my_agg', 'my_type', ...args).range({ from: 10, to: 20 }); const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_agg', 'my_type', { + nameTypeExpectStrategy('my_agg', 'my_type', { ranges: [{ from: 10, to: 20 }] }) ); diff --git a/test/aggregations-test/reverse-nested-agg.test.js b/test/aggregations-test/reverse-nested-agg.test.js index ac2632ce..8e492341 100644 --- a/test/aggregations-test/reverse-nested-agg.test.js +++ b/test/aggregations-test/reverse-nested-agg.test.js @@ -1,10 +1,13 @@ import test from 'ava'; import { ReverseNestedAggregation } from '../../src'; -import { setsAggType, illegalCall, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, illegalCall, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = (...args) => new ReverseNestedAggregation('my_agg', ...args); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'reverse_nested')); +const setsOption = makeSetsOptionMacro( + getInstance, + nameTypeExpectStrategy('my_agg', 'reverse_nested') +); test(setsAggType, ReverseNestedAggregation, 'reverse_nested'); test(illegalCall, ReverseNestedAggregation, 'field', 'my_agg'); diff --git a/test/aggregations-test/sampler-agg.test.js b/test/aggregations-test/sampler-agg.test.js index eb556bbd..5c6a5f55 100644 --- a/test/aggregations-test/sampler-agg.test.js +++ b/test/aggregations-test/sampler-agg.test.js @@ -1,10 +1,10 @@ import test from 'ava'; import { SamplerAggregation } from '../../src'; -import { setsAggType, illegalCall, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, illegalCall, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = (...args) => new SamplerAggregation('my_agg', ...args); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'sampler')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'sampler')); test(setsAggType, SamplerAggregation, 'sampler'); test(illegalCall, SamplerAggregation, 'field', 'my_agg'); diff --git a/test/aggregations-test/scripted-metric-agg.test.js b/test/aggregations-test/scripted-metric-agg.test.js index 08b48a0c..ab2a7dbc 100644 --- a/test/aggregations-test/scripted-metric-agg.test.js +++ b/test/aggregations-test/scripted-metric-agg.test.js @@ -1,12 +1,12 @@ import test from 'ava'; import { ScriptedMetricAggregation } from '../../src'; -import { setsAggType, illegalCall, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, illegalCall, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = () => new ScriptedMetricAggregation('my_agg'); const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_agg', 'scripted_metric') + nameTypeExpectStrategy('my_agg', 'scripted_metric') ); test(setsAggType, ScriptedMetricAggregation, 'scripted_metric'); diff --git a/test/aggregations-test/serial-differencing-agg.test.js b/test/aggregations-test/serial-differencing-agg.test.js index 2ee80f0d..ea7f3587 100644 --- a/test/aggregations-test/serial-differencing-agg.test.js +++ b/test/aggregations-test/serial-differencing-agg.test.js @@ -1,10 +1,13 @@ import test from 'ava'; import { SerialDifferencingAggregation } from '../../src'; -import { setsAggType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { setsAggType, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = bucketsPath => new SerialDifferencingAggregation('my_agg', bucketsPath); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'serial_diff')); +const setsOption = makeSetsOptionMacro( + getInstance, + nameTypeExpectStrategy('my_agg', 'serial_diff') +); test(setsAggType, SerialDifferencingAggregation, 'serial_diff'); test(setsOption, 'lag', { param: 2 }); diff --git a/test/aggregations-test/significant-terms-agg.test.js b/test/aggregations-test/significant-terms-agg.test.js index 56314a64..004b2b4f 100644 --- a/test/aggregations-test/significant-terms-agg.test.js +++ b/test/aggregations-test/significant-terms-agg.test.js @@ -1,12 +1,17 @@ import test from 'ava'; import { SignificantTermsAggregation, TermQuery, Script } from '../../src'; -import { setsAggType, illegalParamType, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { + setsAggType, + illegalParamType, + nameTypeExpectStrategy, + makeSetsOptionMacro +} from '../_macros'; const getInstance = (...args) => new SignificantTermsAggregation('my_agg', ...args); const setsOption = makeSetsOptionMacro( getInstance, - aggsExpectStrategy('my_agg', 'significant_terms') + nameTypeExpectStrategy('my_agg', 'significant_terms') ); const script = new Script().lang('groovy').file('calculate-score').params({ my_modifier: 2 }); diff --git a/test/aggregations-test/terms-agg-base.test.js b/test/aggregations-test/terms-agg-base.test.js index f2f27747..daec22a5 100644 --- a/test/aggregations-test/terms-agg-base.test.js +++ b/test/aggregations-test/terms-agg-base.test.js @@ -1,10 +1,10 @@ import test from 'ava'; import { TermsAggregationBase } from '../../src/aggregations/bucket-aggregations'; -import { validatedCorrectly, aggsExpectStrategy, makeSetsOptionMacro } from '../_macros'; +import { validatedCorrectly, nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = (...args) => new TermsAggregationBase('my_agg', 'my_type', '', ...args); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'my_type')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'my_type')); test(validatedCorrectly, getInstance, 'executionHint', [ 'map', diff --git a/test/aggregations-test/terms-agg.test.js b/test/aggregations-test/terms-agg.test.js index 7fc1025f..8e9e3f20 100644 --- a/test/aggregations-test/terms-agg.test.js +++ b/test/aggregations-test/terms-agg.test.js @@ -3,13 +3,13 @@ import { TermsAggregation } from '../../src'; import { setsAggType, validatedCorrectly, - aggsExpectStrategy, + nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = field => new TermsAggregation('my_agg', field); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'terms')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'terms')); test(setsAggType, TermsAggregation, 'terms'); test(validatedCorrectly, getInstance, 'collectMode', ['depth_first', 'breadth_first']); diff --git a/test/aggregations-test/top-hits-agg.test.js b/test/aggregations-test/top-hits-agg.test.js index 7f82705a..6b2dfa9f 100644 --- a/test/aggregations-test/top-hits-agg.test.js +++ b/test/aggregations-test/top-hits-agg.test.js @@ -4,13 +4,13 @@ import { setsAggType, illegalCall, illegalParamType, - aggsExpectStrategy, + nameTypeExpectStrategy, makeSetsOptionMacro } from '../_macros'; const getInstance = () => new TopHitsAggregation('my_agg'); -const setsOption = makeSetsOptionMacro(getInstance, aggsExpectStrategy('my_agg', 'top_hits')); +const setsOption = makeSetsOptionMacro(getInstance, nameTypeExpectStrategy('my_agg', 'top_hits')); const sortChannel = new Sort('channel', 'desc'); const sortCategories = new Sort('categories', 'desc');