diff --git a/index.js b/index.js index e69de29bb..823362a4f 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,31 @@ +function shout(string) { + return string.toUpperCase() +} + +function whisper(string) { + return string.toLowerCase() +} + +function logShout(string) { + console.log(string.toUpperCase()) +} + +function logWhisper(string) { + console.log(string.toLowerCase()) +} + +function sayHiToGrandma(string) { + if (string.toLowerCase() === string) { + return "I can't hear you!" + } + + if (string.toUpperCase() === string) { + return "YES INDEED!" + } + + if (string === "I love you, Grandma.") { + return "I love you, too." + } + + return "Are you eating enough?" +} diff --git a/test/index-test.js b/test/index-test.js index e21ecb5c3..b1db9fea2 100644 --- a/test/index-test.js +++ b/test/index-test.js @@ -1,4 +1,3 @@ - describe('shout(string)', function() { it('receives one argument and returns it in all caps', function() { expect(shout('hello')).toEqual('HELLO') @@ -12,7 +11,7 @@ describe('whisper(string)', function() { }) describe('logShout(string)', function() { - it('calls console.log() its one argument in all caps', function() { + it('calls console.log() with its one argument in all caps', function() { const spy = expect.spyOn(console, 'log').andCallThrough() logShout('hello') @@ -24,7 +23,7 @@ describe('logShout(string)', function() { }) describe('logWhisper(string)', function() { - it('calls console.log() its one argument in all lowercase', function() { + it('calls console.log() with its one argument in all lowercase', function() { const spy = expect.spyOn(console, 'log').andCallThrough() logWhisper('HELLO')