-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
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,27 @@ | ||
// anomalyDetection.test.js | ||
|
||
import AnomalyDetection from './anomalyDetection'; // Assuming you have an AnomalyDetection class/module | ||
|
||
describe('Anomaly Detection', () => { | ||
let anomalyDetector; | ||
|
||
beforeEach(() => { | ||
anomalyDetector = new AnomalyDetection(); | ||
}); | ||
|
||
test('should detect an anomaly in the data', () => { | ||
const data = [1, 2, 3, 100, 5]; // 100 is an anomaly | ||
const result = anomalyDetector.detect(data); | ||
expect(result).toEqual([100]); | ||
}); | ||
|
||
test('should return an empty array if no anomalies are found', () => { | ||
const data = [1, 2, 3, 4, 5]; | ||
const result = anomalyDetector.detect(data); | ||
expect(result).toEqual([]); | ||
}); | ||
|
||
test('should throw error if data is not provided', () => { | ||
expect(() => anomalyDetector.detect()).toThrow('Data is required'); | ||
}); | ||
}); |