-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathindex.js
74 lines (55 loc) · 1.77 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function shout (string) {
return string.toUpperCase ()
}
/* describe('whisper(string)', function() {
it('receives one argument and returns it in all lowercase', function() {
expect(whisper('HELLO')).toEqual('hello')
})
})*/
function whisper (string) {
return string.toLowerCase ()
}
/* describe('logShout(string)', function() {
it('takes a string argument and logs it in all caps using console.log()', function() {
const spy = expect.spyOn(console, 'log').andCallThrough()
logShout('hello')
expect(spy).toHaveBeenCalledWith('HELLO')
console.log.restore()
})
}) */
function logShout(string) {
console.log(string.toUpperCase())
}
/* describe('logWhisper(string)', function() {
it('takes a string argument and logs it in all lowercase using console.log()', function() {
const spy = expect.spyOn(console, 'log').andCallThrough()
logWhisper('HELLO')
expect(spy).toHaveBeenCalledWith('hello')
console.log.restore()
})
}) */
function logWhisper(string) {
console.log(string.toLowerCase())
}
/* describe('sayHiToGrandma(string)', function() {
it('returns "I can\'t hear you!" if `string` is lowercase', function() {
expect(sayHiToGrandma('hello')).toEqual("I can't hear you!")
})
it('returns "YES INDEED!" if `string` is uppercase', function() {
expect(sayHiToGrandma('HELLO')).toEqual("YES INDEED!")
})
it('returns "I love you, too." if `string` is "I love you, Grandma."`', function() {
expect(sayHiToGrandma("I love you, Grandma.")).toEqual("I love you, too.")
})
}) */
function sayHiToGrandma(string){
if (string === string.toLowerCase()){
return "I can\'t hear you!"
}
if (string === string.toUpperCase()){
return "YES INDEED!"
}
if (string === "I love you, Grandma."){
return "I love you, too."
}
}