From 93eb0e0cbf0af8871842edec6681d1e559dca115 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 17:40:03 +0300 Subject: [PATCH 01/38] Replace false to true --- koans/AboutExpects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutExpects.js b/koans/AboutExpects.js index 52148b243..bb2d11460 100644 --- a/koans/AboutExpects.js +++ b/koans/AboutExpects.js @@ -2,7 +2,7 @@ describe("About Expects", function() { //We shall contemplate truth by testing reality, via spec expectations. it("should expect true", function() { - expect(false).toBeTruthy(); //This should be true + expect(true).toBeTruthy(); //This should be true }); //To understand reality, we must compare our expectations against reality. From 4f6f18802e6af1a66e002db75aba7fcbfeffbf89 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 18:13:42 +0300 Subject: [PATCH 02/38] Assaigning expectedValue = 2 --- koans/AboutExpects.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koans/AboutExpects.js b/koans/AboutExpects.js index bb2d11460..4df1fd2b4 100644 --- a/koans/AboutExpects.js +++ b/koans/AboutExpects.js @@ -7,7 +7,7 @@ describe("About Expects", function() { //To understand reality, we must compare our expectations against reality. it("should expect equality", function () { - var expectedValue = FILL_ME_IN; + var expectedValue = 2; var actualValue = 1 + 1; expect(actualValue === expectedValue).toBeTruthy(); @@ -15,7 +15,7 @@ describe("About Expects", function() { //Some ways of asserting equality are better than others. it("should assert equality a better way", function () { - var expectedValue = FILL_ME_IN; + var expectedValue = 2; var actualValue = 1 + 1; // toEqual() compares using common sense equality. From 52d07c3ccf2efcb2e2d7b1e277aab29a6f83a546 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 18:22:43 +0300 Subject: [PATCH 03/38] assaigning expectValue = '2' --- koans/AboutExpects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutExpects.js b/koans/AboutExpects.js index 4df1fd2b4..17f8a0d8a 100644 --- a/koans/AboutExpects.js +++ b/koans/AboutExpects.js @@ -24,7 +24,7 @@ describe("About Expects", function() { //Sometimes you need to be really exact about what you "type". it("should assert equality with ===", function () { - var expectedValue = FILL_ME_IN; + var expectedValue = '2'; var actualValue = (1 + 1).toString(); // toBe() will always use === to compare. From 04a68608933076e697503742462c04b1fe85b999 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 18:29:12 +0300 Subject: [PATCH 04/38] filling .toEquqlin 2 --- koans/AboutExpects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutExpects.js b/koans/AboutExpects.js index 17f8a0d8a..5715798a9 100644 --- a/koans/AboutExpects.js +++ b/koans/AboutExpects.js @@ -33,6 +33,6 @@ describe("About Expects", function() { //Sometimes we will ask you to fill in the values. it("should have filled in values", function () { - expect(1 + 1).toEqual(FILL_ME_IN); + expect(1 + 1).toEqual(2); }); }); From 3251cd71173512f9f33a03a3f77e0f79d86451c4 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 18:37:30 +0300 Subject: [PATCH 05/38] Filling .toBe() in 'object' --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 6fe4313cc..a4819670a 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -3,7 +3,7 @@ describe("About Arrays", function() { //We shall contemplate truth by testing reality, via spec expectations. it("should create arrays", function() { var emptyArray = []; - expect(typeof(emptyArray)).toBe(FILL_ME_IN); //A mistake? - http:javascript.crockford.com/remedial.html + expect(typeof(emptyArray)).toBe('object'); //A mistake? - http:javascript.crockford.com/remedial.html expect(emptyArray.length).toBe(FILL_ME_IN); var multiTypeArray = [0, 1, "two", function () { return 3; }, {value1: 4, value2: 5}, [6, 7]]; From a5c7fd114a4fa96702f7901de022e56782877ef2 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 18:42:14 +0300 Subject: [PATCH 06/38] Filling .toBe() in 0 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index a4819670a..7f7bb056f 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -4,7 +4,7 @@ describe("About Arrays", function() { it("should create arrays", function() { var emptyArray = []; expect(typeof(emptyArray)).toBe('object'); //A mistake? - http:javascript.crockford.com/remedial.html - expect(emptyArray.length).toBe(FILL_ME_IN); + expect(emptyArray.length).toBe(0); var multiTypeArray = [0, 1, "two", function () { return 3; }, {value1: 4, value2: 5}, [6, 7]]; expect(multiTypeArray[0]).toBe(FILL_ME_IN); From 254ce447282f365300a9d4939f78c50c1db914cf Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 18:44:02 +0300 Subject: [PATCH 07/38] filling .toBe() in 0 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 7f7bb056f..87490c523 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -7,7 +7,7 @@ describe("About Arrays", function() { expect(emptyArray.length).toBe(0); var multiTypeArray = [0, 1, "two", function () { return 3; }, {value1: 4, value2: 5}, [6, 7]]; - expect(multiTypeArray[0]).toBe(FILL_ME_IN); + expect(multiTypeArray[0]).toBe(0); expect(multiTypeArray[2]).toBe(FILL_ME_IN); expect(multiTypeArray[3]()).toBe(FILL_ME_IN); expect(multiTypeArray[4].value1).toBe(FILL_ME_IN); From cf91c5973157bbbbf9ea5126abfccb00cb54101d Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 18:46:31 +0300 Subject: [PATCH 08/38] Filling .toBe() in 'two' --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 87490c523..c413cbcab 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -8,7 +8,7 @@ describe("About Arrays", function() { var multiTypeArray = [0, 1, "two", function () { return 3; }, {value1: 4, value2: 5}, [6, 7]]; expect(multiTypeArray[0]).toBe(0); - expect(multiTypeArray[2]).toBe(FILL_ME_IN); + expect(multiTypeArray[2]).toBe('two'); expect(multiTypeArray[3]()).toBe(FILL_ME_IN); expect(multiTypeArray[4].value1).toBe(FILL_ME_IN); expect(multiTypeArray[4]["value2"]).toBe(FILL_ME_IN); From eca25fa260c8d7945b6feb5c78f5bb1b9a54307d Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 19:03:05 +0300 Subject: [PATCH 09/38] Filling to Be() in 3 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index c413cbcab..33ac4ceb1 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -9,7 +9,7 @@ describe("About Arrays", function() { var multiTypeArray = [0, 1, "two", function () { return 3; }, {value1: 4, value2: 5}, [6, 7]]; expect(multiTypeArray[0]).toBe(0); expect(multiTypeArray[2]).toBe('two'); - expect(multiTypeArray[3]()).toBe(FILL_ME_IN); + expect(multiTypeArray[3]()).toBe(3); expect(multiTypeArray[4].value1).toBe(FILL_ME_IN); expect(multiTypeArray[4]["value2"]).toBe(FILL_ME_IN); expect(multiTypeArray[5][0]).toBe(FILL_ME_IN); From f8f8766a8e32ce918858fb5aa89a27ca1fd4df6b Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 19:05:32 +0300 Subject: [PATCH 10/38] Filling .toBe() with 4 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 33ac4ceb1..2df9d8d3f 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -10,7 +10,7 @@ describe("About Arrays", function() { expect(multiTypeArray[0]).toBe(0); expect(multiTypeArray[2]).toBe('two'); expect(multiTypeArray[3]()).toBe(3); - expect(multiTypeArray[4].value1).toBe(FILL_ME_IN); + expect(multiTypeArray[4].value1).toBe(4); expect(multiTypeArray[4]["value2"]).toBe(FILL_ME_IN); expect(multiTypeArray[5][0]).toBe(FILL_ME_IN); }); From b191fc741f7b6620b5dbb89fe2180b2b5f1d4989 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 19:07:08 +0300 Subject: [PATCH 11/38] Filling .toBe() with 5 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 2df9d8d3f..3c4efdb99 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -11,7 +11,7 @@ describe("About Arrays", function() { expect(multiTypeArray[2]).toBe('two'); expect(multiTypeArray[3]()).toBe(3); expect(multiTypeArray[4].value1).toBe(4); - expect(multiTypeArray[4]["value2"]).toBe(FILL_ME_IN); + expect(multiTypeArray[4]["value2"]).toBe(5); expect(multiTypeArray[5][0]).toBe(FILL_ME_IN); }); From 1e27edd2a06a295d40ff00d449cc9e94fceeead2 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 19:08:57 +0300 Subject: [PATCH 12/38] Filling .toBe() with 6 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 3c4efdb99..c6a370e5e 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -12,7 +12,7 @@ describe("About Arrays", function() { expect(multiTypeArray[3]()).toBe(3); expect(multiTypeArray[4].value1).toBe(4); expect(multiTypeArray[4]["value2"]).toBe(5); - expect(multiTypeArray[5][0]).toBe(FILL_ME_IN); + expect(multiTypeArray[5][0]).toBe(6); }); it("should understand array literals", function () { From 49df79c0974f4f63998f09f08a97843b7801f5bf Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 19:12:03 +0300 Subject: [PATCH 13/38] filling the array with 2 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index c6a370e5e..5bc93ddca 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -23,7 +23,7 @@ describe("About Arrays", function() { expect(array).toEqual([1]); array[1] = 2; - expect(array).toEqual([1, FILL_ME_IN]); + expect(array).toEqual([1, 2]); array.push(3); expect(array).toEqual(FILL_ME_IN); From e3728a5e6fac5c2176f937a63ffe9f27f690e9a0 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 19:13:57 +0300 Subject: [PATCH 14/38] Filling toEqual() with [1, 2, 3] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 5bc93ddca..dae683541 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -26,7 +26,7 @@ describe("About Arrays", function() { expect(array).toEqual([1, 2]); array.push(3); - expect(array).toEqual(FILL_ME_IN); + expect(array).toEqual([1, 2, 3]); }); it("should understand array length", function () { From 6a688176188fa68cd20e709caad902cba8209c60 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 19:15:26 +0300 Subject: [PATCH 15/38] Filling .toBe() with 4 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index dae683541..cd65d0161 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -32,7 +32,7 @@ describe("About Arrays", function() { it("should understand array length", function () { var fourNumberArray = [1, 2, 3, 4]; - expect(fourNumberArray.length).toBe(FILL_ME_IN); + expect(fourNumberArray.length).toBe(4); fourNumberArray.push(5, 6); expect(fourNumberArray.length).toBe(FILL_ME_IN); From 97e970480257ff9b6be43825b7ca4c9d624faf35 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 19:18:03 +0300 Subject: [PATCH 16/38] Filling .toBe() with 6 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index cd65d0161..863eaca9c 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -34,7 +34,7 @@ describe("About Arrays", function() { expect(fourNumberArray.length).toBe(4); fourNumberArray.push(5, 6); - expect(fourNumberArray.length).toBe(FILL_ME_IN); + expect(fourNumberArray.length).toBe(6); var tenEmptyElementArray = new Array(10); expect(tenEmptyElementArray.length).toBe(FILL_ME_IN); From af688367509fe0a2e1a49af860bee6ac40c64a0c Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 19:19:41 +0300 Subject: [PATCH 17/38] Filling .toBe() with 10 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 863eaca9c..9162c5d1d 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -37,7 +37,7 @@ describe("About Arrays", function() { expect(fourNumberArray.length).toBe(6); var tenEmptyElementArray = new Array(10); - expect(tenEmptyElementArray.length).toBe(FILL_ME_IN); + expect(tenEmptyElementArray.length).toBe(10); tenEmptyElementArray.length = 5; expect(tenEmptyElementArray.length).toBe(FILL_ME_IN); From f3196da4eb412d1f07de4044b8f63ff6f7f97181 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 20:43:49 +0300 Subject: [PATCH 18/38] Filling .toBe() with 5 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 9162c5d1d..7224d3905 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -40,7 +40,7 @@ describe("About Arrays", function() { expect(tenEmptyElementArray.length).toBe(10); tenEmptyElementArray.length = 5; - expect(tenEmptyElementArray.length).toBe(FILL_ME_IN); + expect(tenEmptyElementArray.length).toBe(5); }); it("should slice arrays", function () { From 4775b42345b8c4c1efffea6004408b56c487ffc7 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 20:48:20 +0300 Subject: [PATCH 19/38] result = 'peanut' --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 7224d3905..ffeb11ae4 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -46,7 +46,7 @@ describe("About Arrays", function() { it("should slice arrays", function () { var array = ["peanut", "butter", "and", "jelly"]; - expect(array.slice(0, 1)).toEqual(FILL_ME_IN); + expect(array.slice(0, 1)).toEqual(['peanut']); expect(array.slice(0, 2)).toEqual(FILL_ME_IN); expect(array.slice(2, 2)).toEqual(FILL_ME_IN); expect(array.slice(2, 20)).toEqual(FILL_ME_IN); From f1afca818e932385ae7e8d082b804573a6820c90 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 20:50:01 +0300 Subject: [PATCH 20/38] result = ['peanut', 'butter'] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index ffeb11ae4..268284aca 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -47,7 +47,7 @@ describe("About Arrays", function() { var array = ["peanut", "butter", "and", "jelly"]; expect(array.slice(0, 1)).toEqual(['peanut']); - expect(array.slice(0, 2)).toEqual(FILL_ME_IN); + expect(array.slice(0, 2)).toEqual(['peanut', 'butter']); expect(array.slice(2, 2)).toEqual(FILL_ME_IN); expect(array.slice(2, 20)).toEqual(FILL_ME_IN); expect(array.slice(3, 0)).toEqual(FILL_ME_IN); From 7ea8c64845cf3673b62f7d263d3c8051b6c286fd Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 20:53:03 +0300 Subject: [PATCH 21/38] result = ['and', 'jely'] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 268284aca..6c215a39b 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -48,7 +48,7 @@ describe("About Arrays", function() { expect(array.slice(0, 1)).toEqual(['peanut']); expect(array.slice(0, 2)).toEqual(['peanut', 'butter']); - expect(array.slice(2, 2)).toEqual(FILL_ME_IN); + expect(array.slice(2, 2)).toEqual(['and', 'jely']); expect(array.slice(2, 20)).toEqual(FILL_ME_IN); expect(array.slice(3, 0)).toEqual(FILL_ME_IN); expect(array.slice(3, 100)).toEqual(FILL_ME_IN); From 0eb826cad45ac8970f07b721cf6a9aaa696838cd Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 20:59:34 +0300 Subject: [PATCH 22/38] result = [] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 6c215a39b..035c5c410 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -48,7 +48,7 @@ describe("About Arrays", function() { expect(array.slice(0, 1)).toEqual(['peanut']); expect(array.slice(0, 2)).toEqual(['peanut', 'butter']); - expect(array.slice(2, 2)).toEqual(['and', 'jely']); + expect(array.slice(2, 2)).toEqual([]); expect(array.slice(2, 20)).toEqual(FILL_ME_IN); expect(array.slice(3, 0)).toEqual(FILL_ME_IN); expect(array.slice(3, 100)).toEqual(FILL_ME_IN); From 19ecfedf6327e0345b34f546c355904adbb269dd Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:08:03 +0300 Subject: [PATCH 23/38] result = ['and', 'jelly'] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 035c5c410..ce9a910cb 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -49,7 +49,7 @@ describe("About Arrays", function() { expect(array.slice(0, 1)).toEqual(['peanut']); expect(array.slice(0, 2)).toEqual(['peanut', 'butter']); expect(array.slice(2, 2)).toEqual([]); - expect(array.slice(2, 20)).toEqual(FILL_ME_IN); + expect(array.slice(2, 20)).toEqual(['and', 'jelly']); expect(array.slice(3, 0)).toEqual(FILL_ME_IN); expect(array.slice(3, 100)).toEqual(FILL_ME_IN); expect(array.slice(5, 1)).toEqual(FILL_ME_IN); From 42b82f852dfa3ab6c3770fdecd163368c0e794fe Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:08:57 +0300 Subject: [PATCH 24/38] result = [] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index ce9a910cb..3c66c5c90 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -50,7 +50,7 @@ describe("About Arrays", function() { expect(array.slice(0, 2)).toEqual(['peanut', 'butter']); expect(array.slice(2, 2)).toEqual([]); expect(array.slice(2, 20)).toEqual(['and', 'jelly']); - expect(array.slice(3, 0)).toEqual(FILL_ME_IN); + expect(array.slice(3, 0)).toEqual([]); expect(array.slice(3, 100)).toEqual(FILL_ME_IN); expect(array.slice(5, 1)).toEqual(FILL_ME_IN); }); From 0cab7c0179b6ed9ef807781ada266c3ea66a9ffe Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:10:10 +0300 Subject: [PATCH 25/38] result = ['jelly'] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 3c66c5c90..69c16881a 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -51,7 +51,7 @@ describe("About Arrays", function() { expect(array.slice(2, 2)).toEqual([]); expect(array.slice(2, 20)).toEqual(['and', 'jelly']); expect(array.slice(3, 0)).toEqual([]); - expect(array.slice(3, 100)).toEqual(FILL_ME_IN); + expect(array.slice(3, 100)).toEqual(['jelly']); expect(array.slice(5, 1)).toEqual(FILL_ME_IN); }); From 8cdf9f905bb154417fdf080f69417a8b1903ed1c Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:12:31 +0300 Subject: [PATCH 26/38] result = [] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 69c16881a..de44038d3 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -52,7 +52,7 @@ describe("About Arrays", function() { expect(array.slice(2, 20)).toEqual(['and', 'jelly']); expect(array.slice(3, 0)).toEqual([]); expect(array.slice(3, 100)).toEqual(['jelly']); - expect(array.slice(5, 1)).toEqual(FILL_ME_IN); + expect(array.slice(5, 1)).toEqual([]); }); it("should know array references", function () { From 707c6e4442405d8f2488a1da0bdc84319d401096 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:15:12 +0300 Subject: [PATCH 27/38] Filling .toBe() with 'changed in function' --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index de44038d3..3fcaff74e 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -62,7 +62,7 @@ describe("About Arrays", function() { refArray[1] = "changed in function"; } passedByReference(array); - expect(array[1]).toBe(FILL_ME_IN); + expect(array[1]).toBe("changed in fuction"); var assignedArray = array; assignedArray[5] = "changed in assignedArray"; From 10e867f57a1cf8322b4a4652daa81a205f862797 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:19:43 +0300 Subject: [PATCH 28/38] Filling .toBe() with 'changed in assignedArray' --- koans/AboutArrays.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 3fcaff74e..342f3b090 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -62,11 +62,11 @@ describe("About Arrays", function() { refArray[1] = "changed in function"; } passedByReference(array); - expect(array[1]).toBe("changed in fuction"); + expect(array[1]).toBe("changed in function"); var assignedArray = array; assignedArray[5] = "changed in assignedArray"; - expect(array[5]).toBe(FILL_ME_IN); + expect(array[5]).toBe("changed in assignedArray"); var copyOfArray = array.slice(); copyOfArray[3] = "changed in copyOfArray"; From 3c7be699ebff4615bc760bf0640d94d9483db8ea Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:21:26 +0300 Subject: [PATCH 29/38] Filling .toBe() with 'three' --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 342f3b090..fac5b31ef 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -70,7 +70,7 @@ describe("About Arrays", function() { var copyOfArray = array.slice(); copyOfArray[3] = "changed in copyOfArray"; - expect(array[3]).toBe(FILL_ME_IN); + expect(array[3]).toBe('three'); }); it("should push and pop", function () { From e438401340370810390fb9de0a0bccdb2d0b0259 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:22:31 +0300 Subject: [PATCH 30/38] result = [1, 2, 3] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index fac5b31ef..e5e48840e 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -77,7 +77,7 @@ describe("About Arrays", function() { var array = [1, 2]; array.push(3); - expect(array).toEqual(FILL_ME_IN); + expect(array).toEqual([1, 2, 3]); var poppedValue = array.pop(); expect(poppedValue).toBe(FILL_ME_IN); From 521323184ea7f69a3b79f0a6b23bf5950fd06937 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:26:21 +0300 Subject: [PATCH 31/38] popedValue = 3 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index e5e48840e..f4ff98f59 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -80,7 +80,7 @@ describe("About Arrays", function() { expect(array).toEqual([1, 2, 3]); var poppedValue = array.pop(); - expect(poppedValue).toBe(FILL_ME_IN); + expect(poppedValue).toBe(3); expect(array).toEqual(FILL_ME_IN); }); From 4dee15e1f71d96ddea5d11eb201745bdcdc25e18 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:27:17 +0300 Subject: [PATCH 32/38] after poping, array = [1, 2] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index f4ff98f59..2ab48b952 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -81,7 +81,7 @@ describe("About Arrays", function() { var poppedValue = array.pop(); expect(poppedValue).toBe(3); - expect(array).toEqual(FILL_ME_IN); + expect(array).toEqual([1, 2]); }); it("should know about shifting arrays", function () { From 5db8b5bdc921cf0de605fbe0c67ffd7000538768 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:28:53 +0300 Subject: [PATCH 33/38] after unshifting, array = [3, 1, 2] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 2ab48b952..a1a789de3 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -88,7 +88,7 @@ describe("About Arrays", function() { var array = [1, 2]; array.unshift(3); - expect(array).toEqual(FILL_ME_IN); + expect(array).toEqual([3, 1, 2]); var shiftedValue = array.shift(); expect(shiftedValue).toEqual(FILL_ME_IN); From a7b8badba6d61fa0ddf4b9b0646014c9ee4892d1 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:30:33 +0300 Subject: [PATCH 34/38] shiftedValue = 3 --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index a1a789de3..38e8dc6aa 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -91,7 +91,7 @@ describe("About Arrays", function() { expect(array).toEqual([3, 1, 2]); var shiftedValue = array.shift(); - expect(shiftedValue).toEqual(FILL_ME_IN); + expect(shiftedValue).toEqual(3); expect(array).toEqual(FILL_ME_IN); }); }); From 72e725b7751c16e98867f76cf21b239199103d89 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Mon, 12 Oct 2020 21:31:50 +0300 Subject: [PATCH 35/38] after shifting, array = [1, 2] --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 38e8dc6aa..14ec253eb 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -92,6 +92,6 @@ describe("About Arrays", function() { var shiftedValue = array.shift(); expect(shiftedValue).toEqual(3); - expect(array).toEqual(FILL_ME_IN); + expect(array).toEqual([1, 2]); }); }); From 202fea7bf1b8298fcfab46507dc367d3244b1a4c Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Tue, 13 Oct 2020 11:43:39 +0300 Subject: [PATCH 36/38] Passing all tests --- koans/AboutFunctions.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 77b379a3a..1ce6446d2 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -6,7 +6,7 @@ describe("About Functions", function() { return a + b; } - expect(add(1, 2)).toBe(FILL_ME_IN); + expect(add(1, 2)).toBe(3); }); it("should know internal variables override outer variables", function () { @@ -21,9 +21,9 @@ describe("About Functions", function() { return message; } - expect(getMessage()).toBe(FILL_ME_IN); - expect(overrideMessage()).toBe(FILL_ME_IN); - expect(message).toBe(FILL_ME_IN); + expect(getMessage()).toBe('Outer'); + expect(overrideMessage()).toBe('Inner'); + expect(message).toBe('Outer'); }); it("should have lexical scoping", function () { @@ -35,7 +35,7 @@ describe("About Functions", function() { } return childfunction(); } - expect(parentfunction()).toBe(FILL_ME_IN); + expect(parentfunction()).toBe('local'); }); it("should use lexical scoping to synthesise functions", function () { @@ -49,7 +49,7 @@ describe("About Functions", function() { var increaseBy3 = makeIncreaseByFunction(3); var increaseBy5 = makeIncreaseByFunction(5); - expect(increaseBy3(10) + increaseBy5(10)).toBe(FILL_ME_IN); + expect(increaseBy3(10) + increaseBy5(10)).toBe(28); }); it("should allow extra function arguments", function () { @@ -58,13 +58,13 @@ describe("About Functions", function() { return firstArg; } - expect(returnFirstArg("first", "second", "third")).toBe(FILL_ME_IN); + expect(returnFirstArg("first", "second", "third")).toBe('first'); function returnSecondArg(firstArg, secondArg) { return secondArg; } - expect(returnSecondArg("only give first arg")).toBe(FILL_ME_IN); + expect(returnSecondArg("only give first arg")).toBe(undefined); function returnAllArgs() { var argsArray = []; @@ -74,7 +74,7 @@ describe("About Functions", function() { return argsArray.join(","); } - expect(returnAllArgs("first", "second", "third")).toBe(FILL_ME_IN); + expect(returnAllArgs("first", "second", "third")).toBe("first,second,third"); }); it("should pass functions as values", function () { @@ -88,21 +88,24 @@ describe("About Functions", function() { }; var praiseSinger = { givePraise: appendRules }; - expect(praiseSinger.givePraise("John")).toBe(FILL_ME_IN); + expect(praiseSinger.givePraise("John")).toBe('John rules!'); praiseSinger.givePraise = appendDoubleRules; - expect(praiseSinger.givePraise("Mary")).toBe(FILL_ME_IN); + expect(praiseSinger.givePraise("Mary")).toBe('Mary totally rules!'); }); it("should use function body as a string", function () { var add = new Function("a", "b", "return a + b;"); - expect(add(1, 2)).toBe(FILL_ME_IN); + expect(add(1, 2)).toBe(3); var multiply = function (a, b) { //An internal comment return a * b; }; - expect(multiply.toString()).toBe(FILL_ME_IN); + expect(multiply.toString()).toBe(`function (a, b) { + //An internal comment + return a * b; + }`); }); }); From 37378ebeeb6358897f31685b7d45aa3bb72c2697 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Tue, 13 Oct 2020 12:09:48 +0300 Subject: [PATCH 37/38] Passing all tests --- koans/AboutObjects.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 374944e80..760a7a3e2 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -8,12 +8,12 @@ describe("About Objects", function () { }); it("should confirm objects are collections of properties", function () { - expect(meglomaniac.mastermind).toBe(FILL_ME_IN); + expect(meglomaniac.mastermind).toBe("Joker"); }); it("should confirm that properties are case sensitive", function () { - expect(meglomaniac.henchwoman).toBe(FILL_ME_IN); - expect(meglomaniac.henchWoman).toBe(FILL_ME_IN); + expect(meglomaniac.henchwoman).toBe('Harley'); + expect(meglomaniac.henchWoman).toBe(undefined); }); }); @@ -29,7 +29,7 @@ describe("About Objects", function () { }; var battleCry = meglomaniac.battleCry(4); - expect(FILL_ME_IN).toMatch(battleCry); + expect('They are Pinky and the Brain Brain Brain Brain').toMatch(battleCry); }); it("should confirm that when a function is attached to an object, 'this' refers to the object", function () { @@ -44,8 +44,8 @@ describe("About Objects", function () { } }; - expect(currentYear).toBe(FILL_ME_IN); - expect(meglomaniac.calculateAge()).toBe(FILL_ME_IN); + expect(currentYear).toBe(2020); + expect(meglomaniac.calculateAge()).toBe(50); }); describe("'in' keyword", function () { @@ -62,27 +62,27 @@ describe("About Objects", function () { var hasBomb = "theBomb" in meglomaniac; - expect(hasBomb).toBe(FILL_ME_IN); + expect(hasBomb).toBe(true); }); it("should not have the detonator however", function () { var hasDetonator = "theDetonator" in meglomaniac; - expect(hasDetonator).toBe(FILL_ME_IN); + expect(hasDetonator).toBe(false); }); }); it("should know that properties can be added and deleted", function () { var meglomaniac = { mastermind : "Agent Smith", henchman: "Agent Smith" }; - expect("secretary" in meglomaniac).toBe(FILL_ME_IN); + expect("secretary" in meglomaniac).toBe(false); meglomaniac.secretary = "Agent Smith"; - expect("secretary" in meglomaniac).toBe(FILL_ME_IN); + expect("secretary" in meglomaniac).toBe(true); delete meglomaniac.henchman; - expect("henchman" in meglomaniac).toBe(FILL_ME_IN); + expect("henchman" in meglomaniac).toBe(false); }); @@ -96,14 +96,14 @@ describe("About Objects", function () { var colouredCircle = new Circle(5); colouredCircle.colour = "red"; - expect(simpleCircle.colour).toBe(FILL_ME_IN); - expect(colouredCircle.colour).toBe(FILL_ME_IN); + expect(simpleCircle.colour).toBe(undefined); + expect(colouredCircle.colour).toBe('red'); Circle.prototype.describe = function () { return "This circle has a radius of: " + this.radius; }; - expect(simpleCircle.describe()).toBe(FILL_ME_IN); - expect(colouredCircle.describe()).toBe(FILL_ME_IN); + expect(simpleCircle.describe()).toBe("This circle has a radius of: 10"); + expect(colouredCircle.describe()).toBe("This circle has a radius of: 5"); }); }); From 2c6cf65e13d344c4d75f2cb5a3e61888f336c7f0 Mon Sep 17 00:00:00 2001 From: Joseph Levy Date: Tue, 13 Oct 2020 12:17:31 +0300 Subject: [PATCH 38/38] Assaigment complete --- koans/AboutApplyingWhatWeHaveLearnt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutApplyingWhatWeHaveLearnt.js b/koans/AboutApplyingWhatWeHaveLearnt.js index e43eb746a..22f69db43 100644 --- a/koans/AboutApplyingWhatWeHaveLearnt.js +++ b/koans/AboutApplyingWhatWeHaveLearnt.js @@ -12,7 +12,7 @@ describe("About Applying What We Have Learnt", function() { { name: "Blue Moon", ingredients: ["blue cheese", "garlic", "walnuts"], containsNuts: true }, { name: "Taste Of Athens", ingredients: ["spinach", "kalamata olives", "sesame seeds"], containsNuts: true } ]; - }); + }); /*********************************************************************************/