|
1 |
| -import { AverageMean } from "../AverageMean"; |
| 1 | +import { calculateMean } from "../calculateMean"; |
2 | 2 |
|
3 | 3 | describe("Tests for AverageMean", () => {
|
4 | 4 | it("should be a function", () => {
|
5 |
| - expect(typeof AverageMean).toEqual("function"); |
| 5 | + expect(typeof calculateMean).toEqual("function"); |
6 | 6 | });
|
7 | 7 |
|
8 | 8 | it("should throw error for invalid input", () => {
|
9 |
| - expect(() => AverageMean([])).toThrow(); |
| 9 | + expect(() => calculateMean([])).toThrow(); |
10 | 10 | });
|
11 | 11 |
|
12 | 12 | it("should return the mean of an array of consecutive numbers", () => {
|
13 |
| - const meanFunction = AverageMean([1, 2, 3, 4]); |
| 13 | + const meanFunction = calculateMean([1, 2, 3, 4]); |
14 | 14 | expect(meanFunction).toBe(2.5);
|
15 | 15 | });
|
16 | 16 |
|
17 | 17 | it("should return the mean of an array of numbers", () => {
|
18 |
| - const meanFunction = AverageMean([10, 40, 100, 20]); |
| 18 | + const meanFunction = calculateMean([10, 40, 100, 20]); |
19 | 19 | expect(meanFunction).toBe(42.5);
|
20 | 20 | });
|
21 | 21 |
|
22 | 22 | it("should return the mean of an array of decimal numbers", () => {
|
23 |
| - const meanFunction = AverageMean([1.3, 12.67, 99.14, 20]); |
| 23 | + const meanFunction = calculateMean([1.3, 12.67, 99.14, 20]); |
24 | 24 | expect(meanFunction).toBe(33.2775);
|
25 | 25 | });
|
26 | 26 |
|
27 | 27 | it("should return the mean of an array of numbers, including negatives", () => {
|
28 |
| - const meanFunction = AverageMean([10, -40, 100, -20]); |
| 28 | + const meanFunction = calculateMean([10, -40, 100, -20]); |
29 | 29 | expect(meanFunction).toBe(12.5);
|
30 | 30 | });
|
31 | 31 | });
|
0 commit comments