From 0c348dbbb0b3b11b01ebccb124186c4099c9768f Mon Sep 17 00:00:00 2001 From: Novera Lim Date: Mon, 12 Feb 2018 23:07:28 +0000 Subject: [PATCH 1/4] Done. --- test/index-test.js | 60 ++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/test/index-test.js b/test/index-test.js index 72e8bb8..d6a7477 100644 --- a/test/index-test.js +++ b/test/index-test.js @@ -3,58 +3,72 @@ describe('Arrays', function() { window.kittens = ['Milo', 'Otis', 'Garfield']; }); - describe('kittens', function() { +describe('kittens', function() { it('defines kittens as `var kittens = ["Milo", "Otis", "Garfield"]`', function() { - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]) + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) }) describe('destructivelyAppendKitten(name)', function() { it('appends a kitten to the end of the kittens array', function() { - destructivelyAppendKitten('Ralph') - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield", "Ralph"]) + destructivelyAppendKitten('Ralph'); + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield", "Ralph"]); }) }) - - describe('destructivelyPrependKitten(name)', function() { + + describe('destructivelyPrependKitten(name)', function() { it('prepends a kitten to the beginning of the kittens array', function() { - destructivelyPrependKitten("Bob") - - expect(window.kittens).toEqual(["Bob", "Milo", "Otis", "Garfield"]) + destructivelyPrependKitten("Bob"); + expect(window.kittens).toEqual(["Bob", "Milo", "Otis", "Garfield"]); }) }) - + describe('destructivelyRemoveLastKitten()', function() { it('removes the last kitten from the kittens array', function() { - destructivelyRemoveLastKitten() - - expect(window.kittens).toEqual(["Milo", "Otis"]) + destructivelyRemoveLastKitten(); + expect(window.kittens).toEqual(["Milo", "Otis"]); }) }) describe('destructivelyRemoveFirstKitten()', function() { it('removes the First kitten from the kittens array', function() { - destructivelyRemoveFirstKitten() - - expect(window.kittens).toEqual(["Otis", "Garfield"]) + destructivelyRemoveFirstKitten(); + expect(window.kittens).toEqual(["Otis", "Garfield"]); }) }) - - describe('appendKitten(name)', function() { + + describe('appendKitten(name)', function() { it('appends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(appendKitten("Broom")).toEqual(["Milo", "Otis", "Garfield", "Broom"]) - - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]) + expect(appendKitten("Broom")).toEqual(["Milo", "Otis", "Garfield", "Broom"]); + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) }) describe('prependKitten(name)', function() { it('prepends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(prependKitten("Arnold")).toEqual(["Arnold", "Milo", "Otis", "Garfield"]) + expect(prependKitten("Arnold")).toEqual(["Arnold", "Milo", "Otis", "Garfield"]); + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); + }) + }) + + describe('removeLastKitten()', function() { + it('removes the last kitten in the kittens array and returns a new array, leaving the kittens array unchanged', function() { + expect(removeLastKitten()).toEqual(["Milo", "Otis"]); + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); + }) + }) - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]) + describe('removeFirstKitten()', function() { + it('removes the first kitten from the kittens array and returns a new array, leaving the kittens array unchanged', function() { + expect(removeFirstKitten()).toEqual(["Otis", "Garfield"]); + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) }) +}) + + + + describe('removeLastKitten()', function() { it('removes the last kitten in the kittens array and returns a new array, leaving the kittens array unchanged', function() { From 94d45bfc9be4a27eed031ba9594862a012dcd3c1 Mon Sep 17 00:00:00 2001 From: Novera Lim Date: Tue, 13 Feb 2018 00:02:23 +0000 Subject: [PATCH 2/4] Done. --- test/index-test.js | 155 +++++++++++++++++++++++++-------------------- 1 file changed, 88 insertions(+), 67 deletions(-) diff --git a/test/index-test.js b/test/index-test.js index d6a7477..f41d634 100644 --- a/test/index-test.js +++ b/test/index-test.js @@ -1,89 +1,110 @@ -describe('Arrays', function() { +describe('kittens', function() { + it('defines kittens as `var kittens = ["Milo", "Otis", "Garfield"]`', function() { + expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); + } + + describe('Arrays', function() { beforeEach(function() { window.kittens = ['Milo', 'Otis', 'Garfield']; }); - -describe('kittens', function() { + + describe('kittens', function() { it('defines kittens as `var kittens = ["Milo", "Otis", "Garfield"]`', function() { expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) - }) - + }) + describe('destructivelyAppendKitten(name)', function() { it('appends a kitten to the end of the kittens array', function() { destructivelyAppendKitten('Ralph'); - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield", "Ralph"]); - }) - }) - - describe('destructivelyPrependKitten(name)', function() { - it('prepends a kitten to the beginning of the kittens array', function() { - destructivelyPrependKitten("Bob"); - expect(window.kittens).toEqual(["Bob", "Milo", "Otis", "Garfield"]); - }) - }) - - describe('destructivelyRemoveLastKitten()', function() { - it('removes the last kitten from the kittens array', function() { - destructivelyRemoveLastKitten(); - expect(window.kittens).toEqual(["Milo", "Otis"]); - }) - }) + expect(kittens).toEqual(["Milo", "Otis", "Garfield", "Ralph"]); - describe('destructivelyRemoveFirstKitten()', function() { - it('removes the First kitten from the kittens array', function() { - destructivelyRemoveFirstKitten(); - expect(window.kittens).toEqual(["Otis", "Garfield"]); - }) +describe('destructivelyAppendKitten(name)', function() { + it('appends a kitten to the end of the kittens array', function() { + destructivelyAppendKitten('Ralph'); + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield", "Ralph"]); }) - - describe('appendKitten(name)', function() { - it('appends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(appendKitten("Broom")).toEqual(["Milo", "Otis", "Garfield", "Broom"]); - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); + }) + +describe('destructivelyPrependKitten(name)', function() { + it('prepends a kitten to the beginning of the kittens array', function() { + destructivelyPrependKitten("Bob"); + describe('destructivelyPrependKitten(name)', function() { + it('prepends a kitten to the beginning of the kittens array', function() { + destructivelyPrependKitten("Bob"); + expect(kittens).toEqual(["Bob", "Milo", "Otis", "Garfield"]); + expect(window.kittens).toEqual(["Bob", "Milo", "Otis", "Garfield"]); + }) }) }) - describe('prependKitten(name)', function() { - it('prepends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(prependKitten("Arnold")).toEqual(["Arnold", "Milo", "Otis", "Garfield"]); - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); - }) +describe('destructivelyRemoveLastKitten()', function() { + it('removes the last kitten from the kittens array', function() { + destructivelyRemoveLastKitten(); + describe('destructivelyRemoveLastKitten()', function() { + it('removes the last kitten from the kittens array', function() { + expect(kittens).toEqual(["Milo", "Otis"]); + expect(window.kittens).toEqual(["Milo", "Otis"]); + }) + }) }) - - describe('removeLastKitten()', function() { - it('removes the last kitten in the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(removeLastKitten()).toEqual(["Milo", "Otis"]); - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); - }) + +describe('destructivelyRemoveFirstKitten()', function() { + it('removes the First kitten from the kittens array', function() { + destructivelyRemoveFirstKitten(); + describe('destructivelyRemoveFirstKitten()', function() { + it('removes the First kitten from the kittens array', function() { + destructivelyRemoveFirstKitten(); + expect(kittens).toEqual(["Otis", "Garfield"]); + expect(window.kittens).toEqual(["Otis", "Garfield"]); + }) + }) }) - describe('removeFirstKitten()', function() { - it('removes the first kitten from the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(removeFirstKitten()).toEqual(["Otis", "Garfield"]); - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); - }) +describe('appendKitten(name)', function() { + it('appends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { + expect(appendKitten("Broom")).toEqual(["Milo", "Otis", "Garfield", "Broom"]); + describe('appendKitten(name)', function() { + it('appends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { + expect(appendKitten("Broom")).toEqual(["Milo", "Otis", "Garfield", "Broom"]); + expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); + }) + }) }) + + describe('prependKitten(name)', function() { + it('prepends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { + expect(prependKitten("Arnold")).toEqual(["Arnold", "Milo", "Otis", "Garfield"]); +describe('prependKitten(name)', function() { + it('prepends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { + expect(prependKitten("Arnold")).toEqual(["Arnold", "Milo", "Otis", "Garfield"]); +expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); +expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); +}) +}) }) + describe('removeLastKitten()', function() { + it('removes the last kitten in the kittens array and returns a new array, leaving the kittens array unchanged', function() { + expect(removeLastKitten()).toEqual(["Milo", "Otis"]); +describe('removeLastKitten()', function() { + it('removes the last kitten in the kittens array and returns a new array, leaving the kittens array unchanged', function() { +expect(removeLastKitten()).toEqual(["Milo", "Otis"]); +expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); +expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); +}) + }) +}) - - - - describe('removeLastKitten()', function() { - it('removes the last kitten in the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(removeLastKitten()).toEqual(["Milo", "Otis"]) - - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]) - }) - }) - - describe('removeFirstKitten()', function() { - it('removes the first kitten from the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(removeFirstKitten()).toEqual(["Otis", "Garfield"]) - - expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]) - }) - }) - + describe('removeFirstKitten()', function() { + it('removes the first kitten from the kittens array and returns a new array, leaving the kittens array unchanged', function() { + expect(removeFirstKitten()).toEqual(["Otis", "Garfield"]); +describe('removeFirstKitten()', function() { + it('removes the first kitten from the kittens array and returns a new array, leaving the kittens array unchanged', function() { + expect(removeFirstKitten()).toEqual(["Otis", "Garfield"]); + expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); +expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); +}) }) + }) \ No newline at end of file From 54eb18509a013c8ae7c7c1f14148bf3b2ae22c41 Mon Sep 17 00:00:00 2001 From: Novera Lim Date: Tue, 13 Feb 2018 01:23:10 +0000 Subject: [PATCH 3/4] Done. --- test/index-test.js | 63 ++++++++-------------------------------------- 1 file changed, 10 insertions(+), 53 deletions(-) diff --git a/test/index-test.js b/test/index-test.js index f41d634..54e3a72 100644 --- a/test/index-test.js +++ b/test/index-test.js @@ -1,23 +1,13 @@ -describe('kittens', function() { - it('defines kittens as `var kittens = ["Milo", "Otis", "Garfield"]`', function() { - expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); - } - - describe('Arrays', function() { +describe('Arrays', function() { beforeEach(function() { window.kittens = ['Milo', 'Otis', 'Garfield']; }); - describe('kittens', function() { +describe('kittens', function() { it('defines kittens as `var kittens = ["Milo", "Otis", "Garfield"]`', function() { expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) }) - - describe('destructivelyAppendKitten(name)', function() { - it('appends a kitten to the end of the kittens array', function() { - destructivelyAppendKitten('Ralph'); - expect(kittens).toEqual(["Milo", "Otis", "Garfield", "Ralph"]); describe('destructivelyAppendKitten(name)', function() { it('appends a kitten to the end of the kittens array', function() { @@ -27,84 +17,51 @@ describe('destructivelyAppendKitten(name)', function() { }) describe('destructivelyPrependKitten(name)', function() { - it('prepends a kitten to the beginning of the kittens array', function() { - destructivelyPrependKitten("Bob"); - describe('destructivelyPrependKitten(name)', function() { it('prepends a kitten to the beginning of the kittens array', function() { destructivelyPrependKitten("Bob"); - expect(kittens).toEqual(["Bob", "Milo", "Otis", "Garfield"]); expect(window.kittens).toEqual(["Bob", "Milo", "Otis", "Garfield"]); }) }) - }) - + describe('destructivelyRemoveLastKitten()', function() { - it('removes the last kitten from the kittens array', function() { - destructivelyRemoveLastKitten(); - describe('destructivelyRemoveLastKitten()', function() { it('removes the last kitten from the kittens array', function() { - expect(kittens).toEqual(["Milo", "Otis"]); + destructivelyRemoveLastKitten() expect(window.kittens).toEqual(["Milo", "Otis"]); }) }) - }) - + describe('destructivelyRemoveFirstKitten()', function() { - it('removes the First kitten from the kittens array', function() { - destructivelyRemoveFirstKitten(); - describe('destructivelyRemoveFirstKitten()', function() { it('removes the First kitten from the kittens array', function() { destructivelyRemoveFirstKitten(); - expect(kittens).toEqual(["Otis", "Garfield"]); expect(window.kittens).toEqual(["Otis", "Garfield"]); }) }) - }) describe('appendKitten(name)', function() { - it('appends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(appendKitten("Broom")).toEqual(["Milo", "Otis", "Garfield", "Broom"]); - describe('appendKitten(name)', function() { it('appends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { expect(appendKitten("Broom")).toEqual(["Milo", "Otis", "Garfield", "Broom"]); - expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) }) - }) - describe('prependKitten(name)', function() { - it('prepends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(prependKitten("Arnold")).toEqual(["Arnold", "Milo", "Otis", "Garfield"]); describe('prependKitten(name)', function() { it('prepends a kitten to the kittens array and returns a new array, leaving the kittens array unchanged', function() { expect(prependKitten("Arnold")).toEqual(["Arnold", "Milo", "Otis", "Garfield"]); -expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); -expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); -}) + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) }) - describe('removeLastKitten()', function() { - it('removes the last kitten in the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(removeLastKitten()).toEqual(["Milo", "Otis"]); describe('removeLastKitten()', function() { it('removes the last kitten in the kittens array and returns a new array, leaving the kittens array unchanged', function() { -expect(removeLastKitten()).toEqual(["Milo", "Otis"]); -expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); -expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); + expect(removeLastKitten()).toEqual(["Milo", "Otis"]); + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) - }) }) - describe('removeFirstKitten()', function() { - it('removes the first kitten from the kittens array and returns a new array, leaving the kittens array unchanged', function() { - expect(removeFirstKitten()).toEqual(["Otis", "Garfield"]); describe('removeFirstKitten()', function() { it('removes the first kitten from the kittens array and returns a new array, leaving the kittens array unchanged', function() { expect(removeFirstKitten()).toEqual(["Otis", "Garfield"]); - expect(kittens).toEqual(["Milo", "Otis", "Garfield"]); -expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); + expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) }) - }) \ No newline at end of file +}) \ No newline at end of file From 0a4cfde1c1b6e2a88911785bb6f252be3e429e55 Mon Sep 17 00:00:00 2001 From: Novera Lim Date: Tue, 13 Feb 2018 02:28:31 +0000 Subject: [PATCH 4/4] Done. --- test/index-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index-test.js b/test/index-test.js index 54e3a72..afe034f 100644 --- a/test/index-test.js +++ b/test/index-test.js @@ -64,4 +64,4 @@ describe('removeFirstKitten()', function() { expect(window.kittens).toEqual(["Milo", "Otis", "Garfield"]); }) }) -}) \ No newline at end of file +})