* adding method to support terms_agg * adding more filters to kuery bar * addressing PR comments * fixing docs * addressing PR comments * moving file to common * addressing PR comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
33 lines
1 KiB
TypeScript
33 lines
1 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import { SERVICE_ENVIRONMENT } from '../elasticsearch_fieldnames';
|
|
import { ENVIRONMENT_NOT_DEFINED } from '../environment_filter_values';
|
|
import { environmentQuery } from './environment_query';
|
|
|
|
describe('environmentQuery', () => {
|
|
describe('when environment is undefined', () => {
|
|
it('returns an empty query', () => {
|
|
expect(environmentQuery()).toEqual([]);
|
|
});
|
|
});
|
|
|
|
it('creates a query for a service environment', () => {
|
|
expect(environmentQuery('test')).toEqual([
|
|
{
|
|
term: { [SERVICE_ENVIRONMENT]: 'test' },
|
|
},
|
|
]);
|
|
});
|
|
|
|
it('creates a query for missing service environments', () => {
|
|
expect(environmentQuery(ENVIRONMENT_NOT_DEFINED.value)[0]).toHaveProperty(
|
|
['bool', 'must_not', 'exists', 'field'],
|
|
SERVICE_ENVIRONMENT
|
|
);
|
|
});
|
|
});
|