Skip to content
Open

Done #2166

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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."
}
}