-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Bug fixes from ML integration testing (#71564)
* fixes bug where the anomaly detection setup link was showing alert incorrectly, adds unit tests * Fixes typo in getMlBucketSize query, uses terminate_after * Improve readbility of helper function to show alerts and unit tests
- Loading branch information
Showing
3 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
x-pack/plugins/apm/public/components/shared/Links/apm/AnomalyDetectionSetupLink.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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 { showAlert } from './AnomalyDetectionSetupLink'; | ||
|
||
describe('#showAlert', () => { | ||
describe('when an environment is selected', () => { | ||
it('should return true when there are no jobs', () => { | ||
const result = showAlert([], 'testing'); | ||
expect(result).toBe(true); | ||
}); | ||
it('should return true when environment is not included in the jobs', () => { | ||
const result = showAlert( | ||
[{ environment: 'staging' }, { environment: 'production' }], | ||
'testing' | ||
); | ||
expect(result).toBe(true); | ||
}); | ||
it('should return false when environment is included in the jobs', () => { | ||
const result = showAlert( | ||
[{ environment: 'staging' }, { environment: 'production' }], | ||
'staging' | ||
); | ||
expect(result).toBe(false); | ||
}); | ||
}); | ||
describe('there is no environment selected (All)', () => { | ||
it('should return true when there are no jobs', () => { | ||
const result = showAlert([], undefined); | ||
expect(result).toBe(true); | ||
}); | ||
it('should return false when there are any number of jobs', () => { | ||
const result = showAlert( | ||
[{ environment: 'staging' }, { environment: 'production' }], | ||
undefined | ||
); | ||
expect(result).toBe(false); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters