forked from goncy/interview-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.ts
55 lines (49 loc) · 1.21 KB
/
index.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import type { Developer } from "./types";
import { expect, describe, it } from "vitest";
import encontrarLaMedia from ".";
describe("encontrarLaMedia", () => {
it("debería encontrar la media correctamente - 50", () => {
const actual: Developer[] = [
{
firstName: "Maria",
lastName: "Y.",
country: "Cyprus",
continent: "Europe",
age: 30,
language: "Java",
},
{
firstName: "Victoria",
lastName: "T.",
country: "Puerto Rico",
continent: "Americas",
age: 70,
language: "Python",
},
];
const expected = 50;
expect(encontrarLaMedia(actual)).toMatchObject(expected);
});
it("debería encontrar la media correctamente - 21", () => {
const actual: Developer[] = [
{
firstName: "Noa",
lastName: "A.",
country: "Israel",
continent: "Asia",
age: 20,
language: "Ruby",
},
{
firstName: "Andrei",
lastName: "E.",
country: "Romania",
continent: "Europe",
age: 21,
language: "C",
},
];
const expected = 21;
expect(encontrarLaMedia(actual)).toMatchObject(expected);
});
});