forked from tsivinsky/hi-mom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
53 lines (40 loc) · 1.54 KB
/
index.test.js
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
import { hiMom } from "./index";
test("should say hi to mom", () => {
expect(hiMom()).toBe("Hi, mom!");
});
test("should not say hi to dad", () => {
expect(hiMom()).not.toBe("Hi, dad!");
});
test("should say hi to Mother when requested", () => {
expect(hiMom("Mother")).toBe("Hi, Mother!");
});
test("should say hi to mom in tamil when requested", () => {
expect(hiMom("", "ta")).toContain("வணக்கம் அம்மா");
});
test("should say hi to mom in german when requested", () => {
expect(hiMom("", "de")).toContain("Hallo");
});
test("should say hi to mom in russian when requested", () => {
expect(hiMom("", "ru")).toBe("Привет, мама!");
});
test("should say hi to Mother in french when requested", () => {
expect(hiMom("Mother", "fr")).toContain("Mother");
});
test("should say hi to Mother in arabic when requested", () => {
expect(hiMom("", "ar-IQ")).toContain("يمه");
});
test("should say hi to Mother in darija (Moroccan Arabic) when requested", () => {
expect(hiMom("", "ar-MA")).toContain("ماما");
});
test("nl-Be should not say the same as nl-NL when requested", () => {
expect(hiMom("", "nl-BE")).not.toBe(hiMom("", "nl-NL"));
});
test("should say hi to Mother in assamese when requested", () => {
expect(hiMom("", "as")).toContain("অ' মা");
});
test("should throw error when requested", () => {
expect(() => hiMom("", "")).toThrowError(/language/i);
});
test("should not be able to access the prototype", () => {
expect(() => hiMom("", "constructor")).toThrowError(/language/i);
});