fix: doesExceedThreshold greater than logic (#408)

This commit is contained in:
Warren 2024-05-23 01:13:04 -07:00 committed by GitHub
parent 4176710570
commit 884938a2f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
'@hyperdx/api': patch
---
fix: doesExceedThreshold greater than logic

View file

@ -84,9 +84,11 @@ describe('checkAlerts', () => {
it('doesExceedThreshold', () => {
expect(doesExceedThreshold(true, 10, 11)).toBe(true);
expect(doesExceedThreshold(true, 10, 10)).toBe(true);
expect(doesExceedThreshold(false, 10, 9)).toBe(true);
expect(doesExceedThreshold(true, 10, 10)).toBe(false);
expect(doesExceedThreshold(true, 10, 9)).toBe(false);
expect(doesExceedThreshold(false, 10, 11)).toBe(false);
expect(doesExceedThreshold(false, 10, 10)).toBe(false);
expect(doesExceedThreshold(false, 10, 9)).toBe(true);
});
it('expandToNestedObject', () => {

View file

@ -100,7 +100,7 @@ export const doesExceedThreshold = (
threshold: number,
value: number,
) => {
if (isThresholdTypeAbove && value >= threshold) {
if (isThresholdTypeAbove && value > threshold) {
return true;
} else if (!isThresholdTypeAbove && value < threshold) {
return true;