-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
41 lines (31 loc) · 1.79 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
const emj = require("./index.js")
const hasEmojisTestCases = [["हिन्दी1️⃣", true], ["`हिन्दी1#3eng`", false]]
describe("hasEmojis() function:", () => {
test.each(hasEmojisTestCases)("given %s as argument, returns %p", (input, output) => {
expect(emj.hasEmojis(input)).toBe(output)
})
})
const hasNoEmojisTestCases = [["हिन्दी1️⃣", false], ["हिन्दी1#3eng", true]]
describe("hasNoEmojis() function:", () => {
test.each(hasNoEmojisTestCases)("given %s as argument, returns %p", (input, output) => {
expect(emj.hasNoEmojis(input)).toBe(output)
})
})
const hasOnlyEmojisTestCases = [["🆗❤🧡💛💲💚💝💜1️⃣", true], ["00️⃣11️⃣22️⃣##️⃣**️⃣", false]]
describe("hasOnlyEmojis() function:", () => {
test.each(hasOnlyEmojisTestCases)("given %s as argument, returns %p", (input, output) => {
expect(emj.hasOnlyEmojis(input)).toBe(output)
})
})
const removeEmojisTestCases = [["हिन्दी1💜#31️⃣में", "हिन्दी1#3में"], ["🆗❤🧡💛💲💚💝💜1️⃣", ""], ["हिन्दी1#3eng", "हिन्दी1#3eng"]]
describe("removeEmojis() function:", () => {
test.each(removeEmojisTestCases)("given %s as argument, returns %s", (input, output) => {
expect(emj.removeEmojis(input)).toBe(output)
})
})
const removeNonEmojisTestCases = [["हिन्दी1💜#31️⃣में", "💜1️⃣"], ["🆗❤🧡💛💲💚💝💜1️⃣", "🆗❤🧡💛💲💚💝💜1️⃣"], ["हिन्दी1#3eng", ""]]
describe("removeNonEmojis() function:", () => {
test.each(removeNonEmojisTestCases)("given %s as argument, returns %s", (input, output) => {
expect(emj.removeNonEmojis(input)).toBe(output)
})
})