[APM] remove redundant unit tests for getEnvironment (#152577)

## Summary

Removes redundant Unit Tests and Snapshots.

As part of the list mentioned here
https://github.com/elastic/kibana/issues/152557#issuecomment-1451790793,
the getEnvironment logic now has its own API tests and hence we can
remove these unit tests.

API tests were added as part of this
[PR](https://github.com/elastic/kibana/pull/150175/files#diff-00aefdb700a89f09360583a1a951083746eb2243e0607de9ab6bc81826a7adaf)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Achyut Jhunjhunwala 2023-03-07 11:47:34 +01:00 committed by GitHub
parent 883b45fa55
commit bc64e05281
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 135 deletions

View file

@ -1,86 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`getEnvironments fetches environments 1`] = `
Object {
"apm": Object {
"events": Array [
"transaction",
"metric",
"error",
],
},
"body": Object {
"aggs": Object {
"environments": Object {
"terms": Object {
"field": "service.environment",
"missing": "ENVIRONMENT_NOT_DEFINED",
"size": 50,
},
},
},
"query": Object {
"bool": Object {
"filter": Array [
Object {
"range": Object {
"@timestamp": Object {
"format": "epoch_millis",
"gte": 0,
"lte": 50000,
},
},
},
Object {
"term": Object {
"service.name": "foo",
},
},
],
},
},
"size": 0,
"track_total_hits": false,
},
}
`;
exports[`getEnvironments fetches environments without a service name 1`] = `
Object {
"apm": Object {
"events": Array [
"transaction",
"metric",
"error",
],
},
"body": Object {
"aggs": Object {
"environments": Object {
"terms": Object {
"field": "service.environment",
"missing": "ENVIRONMENT_NOT_DEFINED",
"size": 50,
},
},
},
"query": Object {
"bool": Object {
"filter": Array [
Object {
"range": Object {
"@timestamp": Object {
"format": "epoch_millis",
"gte": 0,
"lte": 50000,
},
},
},
],
},
},
"size": 0,
"track_total_hits": false,
},
}
`;

View file

@ -1,49 +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
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { getEnvironments } from './get_environments';
import {
SearchParamsMock,
inspectSearchParams,
} from '../../utils/test_helpers';
describe('getEnvironments', () => {
let mock: SearchParamsMock;
afterEach(() => {
mock.teardown();
});
it('fetches environments', async () => {
mock = await inspectSearchParams(({ mockApmEventClient }) =>
getEnvironments({
apmEventClient: mockApmEventClient,
serviceName: 'foo',
searchAggregatedTransactions: false,
size: 50,
start: 0,
end: 50000,
})
);
expect(mock.params).toMatchSnapshot();
});
it('fetches environments without a service name', async () => {
mock = await inspectSearchParams(({ mockApmEventClient }) =>
getEnvironments({
apmEventClient: mockApmEventClient,
searchAggregatedTransactions: false,
size: 50,
start: 0,
end: 50000,
})
);
expect(mock.params).toMatchSnapshot();
});
});