From 9651b64f31fe80979f1b99e5153cca16410940e5 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Wed, 28 Jun 2023 13:02:54 -0600 Subject: [PATCH 01/64] Create dragon features --- mythical-creatures/exercises/dragon.js | 9 +- mythical-creatures/test/dragon-test.js | 10 +- package-lock.json | 282 ++++++++++++++++++++++++- 3 files changed, 293 insertions(+), 8 deletions(-) diff --git a/mythical-creatures/exercises/dragon.js b/mythical-creatures/exercises/dragon.js index 0037230de..c42ab7794 100644 --- a/mythical-creatures/exercises/dragon.js +++ b/mythical-creatures/exercises/dragon.js @@ -1,7 +1,12 @@ - +function createDragon(name, rider) { + return { + name: name, + rider: rider + } +} module.exports = { - // createDragon, + createDragon, // greetRider, // eat, // findFireBreathers diff --git a/mythical-creatures/test/dragon-test.js b/mythical-creatures/test/dragon-test.js index c5f035bd4..ba6b30245 100644 --- a/mythical-creatures/test/dragon-test.js +++ b/mythical-creatures/test/dragon-test.js @@ -3,33 +3,33 @@ var { createDragon, greetRider, eat, findFireBreathers} = require('../exercises/ describe('Dragon', function() { - it.skip('should be able to create a dragon with a name', function() { + it('should be able to create a dragon with a name', function() { var dragon = createDragon('Jeff'); assert.equal(dragon.name, 'Jeff'); }); - it.skip('should be able to have a different name', function() { + it('should be able to have a different name', function() { var dragon = createDragon('Louisa'); assert.equal(dragon.name, 'Louisa'); }); - it.skip('should have a rider', function() { + it('should have a rider', function() { var dragon = createDragon('Saphira', 'Eragon'); assert.equal(dragon.name, 'Saphira'); assert.equal(dragon.rider, 'Eragon'); }); - it.skip('should be able to have a different rider', function() { + it('should be able to have a different rider', function() { var dragon = createDragon('Elliot', 'Pete'); assert.equal(dragon.name, 'Elliot'); assert.equal(dragon.rider, 'Pete'); }); - it.skip('should have a temperment', function() { + it('should have a temperment', function() { var dragon = createDragon('Saphira', 'Eragon', 'gentle'); assert.equal(dragon.name, 'Saphira'); diff --git a/package-lock.json b/package-lock.json index a14533844..6c29b90e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,288 @@ { "name": "foundations", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "foundations", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "chai": "^4.2.0", + "mocha": "^5.2.0" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "engines": { + "node": "*" + } + }, + "node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + }, + "node_modules/chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "engines": { + "node": "*" + } + }, + "node_modules/commander": { + "version": "2.15.1", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "engines": { + "node": "*" + } + }, + "node_modules/glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "bin": { + "he": "bin/he" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "node_modules/mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "dependencies": { + "minimist": "0.0.8" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dependencies": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "engines": { + "node": "*" + } + }, + "node_modules/supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "engines": { + "node": ">=4" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + }, "dependencies": { "assertion-error": { "version": "1.1.0", From a579831817ba4ecc47ab6a99fe776ac0fb29d5f7 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Wed, 28 Jun 2023 13:05:01 -0600 Subject: [PATCH 02/64] Fix typos --- README.md | 6 +++--- mythical-creatures/test/dragon-test.js | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 503c0e03c..f34ee3b5c 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,13 @@ You should see something like: - should be able to have a different name - should have a rider - should be able to have a different rider - - should have a temperment - - should be able to have different temperments + - should have a temperament + - should be able to have different temperaments - should greet their rider - should start off having eaten 0 times - should start off being hungry - should be full after eating 3 times - - should be a fireBreather if aggressive in temperment + - should be a fireBreather if aggressive in temperament 0 passing (6ms) 11 pending diff --git a/mythical-creatures/test/dragon-test.js b/mythical-creatures/test/dragon-test.js index c5f035bd4..ed22dadbb 100644 --- a/mythical-creatures/test/dragon-test.js +++ b/mythical-creatures/test/dragon-test.js @@ -29,26 +29,26 @@ describe('Dragon', function() { assert.equal(dragon.rider, 'Pete'); }); - it.skip('should have a temperment', function() { + it.skip('should have a temperament', function() { var dragon = createDragon('Saphira', 'Eragon', 'gentle'); assert.equal(dragon.name, 'Saphira'); assert.equal(dragon.rider, 'Eragon'); - assert.equal(dragon.temperment, 'gentle'); + assert.equal(dragon.temperament, 'gentle'); }); - it.skip('should be able to have different temperments', function() { + it.skip('should be able to have different temperaments', function() { var dragon1 = createDragon('Gray', 'Marley', 'aggressive'); var dragon2 = createDragon('Sky', 'Susie', 'gentle'); assert.equal(dragon1.name, 'Gray'); assert.equal(dragon1.rider, 'Marley'); - assert.equal(dragon1.temperment, 'aggressive'); + assert.equal(dragon1.temperament, 'aggressive'); assert.equal(dragon2.name, 'Sky'); assert.equal(dragon2.rider, 'Susie'); - assert.equal(dragon2.temperment, 'gentle'); + assert.equal(dragon2.temperament, 'gentle'); }); it.skip('should greet their rider', function() { @@ -94,7 +94,7 @@ describe('Dragon', function() { }); //Spicy: - it.skip('should be a fireBreather if aggressive in temperment', function() { + it.skip('should be a fireBreather if aggressive in temperament', function() { var dragon1 = createDragon('Gray', 'Marley', 'aggressive'); var dragon2 = createDragon('Sky', 'Susie', 'gentle'); var dragon3 = createDragon('Mushu', 'Mulan', 'aggressive'); From c4b1230a7cc95ce19ba6b86f122478946c88d28f Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Wed, 28 Jun 2023 13:12:25 -0600 Subject: [PATCH 03/64] Fix typos and create greet rider function --- mythical-creatures/exercises/dragon.js | 11 ++++++++--- mythical-creatures/test/dragon-test.js | 12 ++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/mythical-creatures/exercises/dragon.js b/mythical-creatures/exercises/dragon.js index c42ab7794..0e4153baa 100644 --- a/mythical-creatures/exercises/dragon.js +++ b/mythical-creatures/exercises/dragon.js @@ -1,13 +1,18 @@ -function createDragon(name, rider) { +function createDragon(name, rider, temperament) { return { name: name, - rider: rider + rider: rider, + temperament: temperament } } +function greetRider(dragon){ + return `Hi, ${dragon.rider}!` +} + module.exports = { createDragon, - // greetRider, + greetRider, // eat, // findFireBreathers } \ No newline at end of file diff --git a/mythical-creatures/test/dragon-test.js b/mythical-creatures/test/dragon-test.js index ba6b30245..6746f94a5 100644 --- a/mythical-creatures/test/dragon-test.js +++ b/mythical-creatures/test/dragon-test.js @@ -34,24 +34,24 @@ describe('Dragon', function() { assert.equal(dragon.name, 'Saphira'); assert.equal(dragon.rider, 'Eragon'); - assert.equal(dragon.temperment, 'gentle'); + assert.equal(dragon.temperament, 'gentle'); }); - it.skip('should be able to have different temperments', function() { + it('should be able to have different temperments', function() { var dragon1 = createDragon('Gray', 'Marley', 'aggressive'); var dragon2 = createDragon('Sky', 'Susie', 'gentle'); assert.equal(dragon1.name, 'Gray'); assert.equal(dragon1.rider, 'Marley'); - assert.equal(dragon1.temperment, 'aggressive'); + assert.equal(dragon1.temperament, 'aggressive'); assert.equal(dragon2.name, 'Sky'); assert.equal(dragon2.rider, 'Susie'); - assert.equal(dragon2.temperment, 'gentle'); + assert.equal(dragon2.temperament, 'gentle'); }); - it.skip('should greet their rider', function() { + it('should greet their rider', function() { var dragon1 = createDragon('Gray', 'Marley', 'aggressive'); var dragon2 = createDragon('Sky', 'Susie', 'gentle'); @@ -94,7 +94,7 @@ describe('Dragon', function() { }); //Spicy: - it.skip('should be a fireBreather if aggressive in temperment', function() { + it.skip('should be a fireBreather if aggressive in temperament', function() { var dragon1 = createDragon('Gray', 'Marley', 'aggressive'); var dragon2 = createDragon('Sky', 'Susie', 'gentle'); var dragon3 = createDragon('Mushu', 'Mulan', 'aggressive'); From 7f422c2fa06e5e152b9e9004e024bd2c2f865eb7 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Wed, 28 Jun 2023 13:32:15 -0600 Subject: [PATCH 04/64] Create eat function --- mythical-creatures/exercises/dragon.js | 14 ++++++++++++-- mythical-creatures/test/dragon-test.js | 14 +++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/mythical-creatures/exercises/dragon.js b/mythical-creatures/exercises/dragon.js index 0e4153baa..30aa8a946 100644 --- a/mythical-creatures/exercises/dragon.js +++ b/mythical-creatures/exercises/dragon.js @@ -2,7 +2,9 @@ function createDragon(name, rider, temperament) { return { name: name, rider: rider, - temperament: temperament + temperament: temperament, + timesEaten: 0, + hungry: true } } @@ -10,9 +12,17 @@ function greetRider(dragon){ return `Hi, ${dragon.rider}!` } +function eat(dragon){ + dragon.timesEaten += 1; + if (dragon.timesEaten > 2){ + dragon.hungry = false + } + return dragon +} + module.exports = { createDragon, greetRider, - // eat, + eat, // findFireBreathers } \ No newline at end of file diff --git a/mythical-creatures/test/dragon-test.js b/mythical-creatures/test/dragon-test.js index 6746f94a5..215974e1d 100644 --- a/mythical-creatures/test/dragon-test.js +++ b/mythical-creatures/test/dragon-test.js @@ -62,31 +62,31 @@ describe('Dragon', function() { assert.equal(greeting2, 'Hi, Susie!'); }); - it.skip('should start off having eaten 0 times', function() { + it('should start off having eaten 0 times', function() { var dragon = createDragon('Mushu', 'Mulan', 'aggressive'); assert.equal(dragon.timesEaten, 0); }); - it.skip('should start off being hungry', function() { + it('should start off being hungry', function() { var dragon = createDragon('Mushu', 'Mulan', 'aggressive'); assert.equal(dragon.hungry, true); }); - it.skip('should be full after eating 3 times', function() { + it('should be full after eating 3 times', function() { var dragon = createDragon('Lady Vox', 'Emily', 'gentle'); var fedDragon = eat(dragon); - + assert.equal(fedDragon.timesEaten, 1); assert.equal(fedDragon.hungry, true); - + var doubleFedDragon = eat(fedDragon); - + assert.equal(doubleFedDragon.timesEaten, 2); assert.equal(doubleFedDragon.hungry, true); - + var tripleFedDragon = eat(doubleFedDragon); assert.equal(tripleFedDragon.timesEaten, 3); From 7db1717c3c31b6cea34634aed9aaa69d4681ac41 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Wed, 28 Jun 2023 13:42:31 -0600 Subject: [PATCH 05/64] Complete dragon --- mythical-creatures/exercises/dragon.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mythical-creatures/exercises/dragon.js b/mythical-creatures/exercises/dragon.js index 30aa8a946..c0b1cbe0b 100644 --- a/mythical-creatures/exercises/dragon.js +++ b/mythical-creatures/exercises/dragon.js @@ -20,6 +20,11 @@ function eat(dragon){ return dragon } +// function findFireBreathers(dragons){ +// var fireBreathers = dragons.find(dragon => dragon.temperament === "aggressive") +// return fireBreathers +// } + module.exports = { createDragon, greetRider, From 80014d16f0da10346bdbf81d6cfef5e114d9b70e Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Thu, 29 Jun 2023 17:35:00 -0600 Subject: [PATCH 06/64] Create Hobbit --- mythical-creatures/exercises/hobbit.js | 10 ++++++++-- mythical-creatures/test/hobbit-test.js | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mythical-creatures/exercises/hobbit.js b/mythical-creatures/exercises/hobbit.js index 6d9602430..939e54d26 100644 --- a/mythical-creatures/exercises/hobbit.js +++ b/mythical-creatures/exercises/hobbit.js @@ -1,7 +1,13 @@ - +function createHobbit(name = 'unknown', age = 0) { + return{ + name: name, + age: age, + isAdult: + } +} module.exports = { - // createHobbit, + createHobbit, // celebrateBirthday, // getRing, // meetPeople, diff --git a/mythical-creatures/test/hobbit-test.js b/mythical-creatures/test/hobbit-test.js index fa53686c0..ea702cc29 100644 --- a/mythical-creatures/test/hobbit-test.js +++ b/mythical-creatures/test/hobbit-test.js @@ -3,7 +3,7 @@ var {createHobbit, celebrateBirthday, getRing, meetPeople, findFriends} = requir describe('Hobbit', function() { - it.skip('should make a hobbit with a name and age', function() { + it('should make a hobbit with a name and age', function() { var bilbo = createHobbit('Bilbo', 0); var mark = createHobbit('Mark', 5); @@ -14,20 +14,20 @@ describe('Hobbit', function() { assert.equal(mark.age, 5); }); - it.skip('should start out 0 years old if not specified', function() { + it('should start out 0 years old if not specified', function() { var bilbo = createHobbit('Bilbo'); assert.equal(bilbo.age, 0); }); - it.skip('should return an object with defaults if nothing passed', function() { + it('should return an object with defaults if nothing passed', function() { var hobbit = createHobbit(); assert.equal(hobbit.name, 'unknown'); assert.equal(hobbit.age, 0); }); - it.skip('should gain 1 year after every birthday', function() { + it('should gain 1 year after every birthday', function() { var hobbit = createHobbit('Meriadoc'); var olderHobbit = celebrateBirthday(hobbit); From 9b4b3d34a8218112e7eeeea66ece0edd7fc5a75d Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Thu, 29 Jun 2023 18:07:16 -0600 Subject: [PATCH 07/64] Age hobbit --- mythical-creatures/exercises/hobbit.js | 14 ++++++++++++-- mythical-creatures/test/hobbit-test.js | 6 +++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mythical-creatures/exercises/hobbit.js b/mythical-creatures/exercises/hobbit.js index 939e54d26..dcf9c23a7 100644 --- a/mythical-creatures/exercises/hobbit.js +++ b/mythical-creatures/exercises/hobbit.js @@ -1,14 +1,24 @@ function createHobbit(name = 'unknown', age = 0) { + const isAdult = age > 32; + const isOld = age > 100; return{ name: name, age: age, - isAdult: + isAdult: isAdult, + isOld: isOld } } +function celebrateBirthday(hobbit) { + hobbit.age +=1; + hobbit.isAdult = hobbit.age > 32; + hobbit.isOld = hobbit.age > 100; + return hobbit +} + module.exports = { createHobbit, - // celebrateBirthday, + celebrateBirthday, // getRing, // meetPeople, // findFriends diff --git a/mythical-creatures/test/hobbit-test.js b/mythical-creatures/test/hobbit-test.js index ea702cc29..ddf6d9de7 100644 --- a/mythical-creatures/test/hobbit-test.js +++ b/mythical-creatures/test/hobbit-test.js @@ -37,7 +37,7 @@ describe('Hobbit', function() { assert.equal(evenOlderStillHobbit.age, 3); }); - it.skip('should be considered a child at the age of 32', function() { + it('should be considered a child at the age of 32', function() { var taylor = createHobbit('Taylor', 31); assert.equal(taylor.age, 31); @@ -49,7 +49,7 @@ describe('Hobbit', function() { assert.equal(olderTaylor.isAdult, false); }); - it.skip('should be considered an adult at 33', function() { + it('should be considered an adult at 33', function() { var ryan = createHobbit('Ryan', 32); var olderRyan = celebrateBirthday(ryan); @@ -58,7 +58,7 @@ describe('Hobbit', function() { assert.equal(olderRyan.isAdult, true); }); - it.skip('should be considered old at the age of 101', function() { + it('should be considered old at the age of 101', function() { var samwise = createHobbit('Samwise', 99); assert.equal(samwise.age, 99) From 55db33cae3e141a851c3637c1b1d068c90dc131b Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:26:27 -0600 Subject: [PATCH 08/64] Create hobbit meet people functionality --- mythical-creatures/exercises/hobbit.js | 24 ++++++++++++++++++++---- mythical-creatures/test/hobbit-test.js | 6 +++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/mythical-creatures/exercises/hobbit.js b/mythical-creatures/exercises/hobbit.js index dcf9c23a7..45d198ccb 100644 --- a/mythical-creatures/exercises/hobbit.js +++ b/mythical-creatures/exercises/hobbit.js @@ -5,21 +5,37 @@ function createHobbit(name = 'unknown', age = 0) { name: name, age: age, isAdult: isAdult, - isOld: isOld + isOld: isOld, + acquaintances: [], } } function celebrateBirthday(hobbit) { - hobbit.age +=1; + hobbit.age++ ; hobbit.isAdult = hobbit.age > 32; hobbit.isOld = hobbit.age > 100; return hobbit } +function getRing(hobbit) { + if (hobbit.name === 'Frodo') { + return 'Here is the ring!'; + } else { + return 'You can\'t have it!'; + } +} + +function meetPeople(person, newAcquiantances) { + for (var i = 0; i < newAcquiantances.length; i++) { + person.acquaintances.push(newAcquiantances[i]); + } + return person; +} + module.exports = { createHobbit, celebrateBirthday, - // getRing, - // meetPeople, + getRing, + meetPeople, // findFriends } \ No newline at end of file diff --git a/mythical-creatures/test/hobbit-test.js b/mythical-creatures/test/hobbit-test.js index ddf6d9de7..d9c07e64a 100644 --- a/mythical-creatures/test/hobbit-test.js +++ b/mythical-creatures/test/hobbit-test.js @@ -75,7 +75,7 @@ describe('Hobbit', function() { assert.equal(hundredAndOneSamwise.isOld, true) }); - it.skip('should be able to get the ring if its name is Frodo', function() { + it('should be able to get the ring if its name is Frodo', function() { var hobbit1 = createHobbit('Frodo'); var hobbit2 = createHobbit('Samwise'); @@ -83,7 +83,7 @@ describe('Hobbit', function() { assert.equal(getRing(hobbit2), 'You can\'t have it!'); }); - it.skip('should start with no acquaintances', function() { + it('should start with no acquaintances', function() { var bilbo = createHobbit('Bilbo'); assert.equal(bilbo.name, 'Bilbo'); @@ -92,7 +92,7 @@ describe('Hobbit', function() { }); //Spicy - it.skip('should be able to meet people', function() { + it('should be able to meet people', function() { var people = [ {name: 'Nick', relationship: 'friend'} ]; var bilbo = createHobbit('Bilbo'); From 734013dbab77ab8bba2ce09b9c64d208a088f708 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:30:27 -0600 Subject: [PATCH 09/64] Meet multiple people --- mythical-creatures/test/hobbit-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythical-creatures/test/hobbit-test.js b/mythical-creatures/test/hobbit-test.js index d9c07e64a..f987d2a63 100644 --- a/mythical-creatures/test/hobbit-test.js +++ b/mythical-creatures/test/hobbit-test.js @@ -104,7 +104,7 @@ describe('Hobbit', function() { assert.equal(socialBilbo.acquaintances[0].relationship, 'friend'); }); - it.skip('should be able to meet several people at once', function() { + it('should be able to meet several people at once', function() { var people = [ {name: 'Nick', relationship: 'friend'}, {name: 'Ben', relationship: 'enemy'} ]; var bilbo = createHobbit('Bilbo'); From e289b86caf4bf6b7c8640be0a7d6c1cef00c52ba Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:30:44 -0600 Subject: [PATCH 10/64] Meet multiple people --- mythical-creatures/test/hobbit-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythical-creatures/test/hobbit-test.js b/mythical-creatures/test/hobbit-test.js index f987d2a63..0877eaaeb 100644 --- a/mythical-creatures/test/hobbit-test.js +++ b/mythical-creatures/test/hobbit-test.js @@ -117,7 +117,7 @@ describe('Hobbit', function() { assert.deepEqual(socialBilbo.acquaintances, people); }); - it.skip('should be able to meet people on multiple occasions', function() { + it('should be able to meet people on multiple occasions', function() { var nick = {name: 'Nick', relationship: 'friend'}; var ben = {name: 'Ben', relationship: 'enemy'}; var people = [ nick, ben ]; From 42a05b51379d7ad441caebbddece072e0bb5d8c1 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:35:28 -0600 Subject: [PATCH 11/64] Find friends --- mythical-creatures/exercises/hobbit.js | 12 +++++++++++- mythical-creatures/test/hobbit-test.js | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mythical-creatures/exercises/hobbit.js b/mythical-creatures/exercises/hobbit.js index 45d198ccb..37efc938d 100644 --- a/mythical-creatures/exercises/hobbit.js +++ b/mythical-creatures/exercises/hobbit.js @@ -32,10 +32,20 @@ function meetPeople(person, newAcquiantances) { return person; } +function findFriends(person) { + var friends = [] + for (var i = 0; i < person.acquaintances.length; i++) { + if (person.acquaintances[i].relationship === 'friend') { + friends.push(person.acquaintances[i].name); + } + } + return friends; +} + module.exports = { createHobbit, celebrateBirthday, getRing, meetPeople, - // findFriends + findFriends } \ No newline at end of file diff --git a/mythical-creatures/test/hobbit-test.js b/mythical-creatures/test/hobbit-test.js index 0877eaaeb..bd3136ce7 100644 --- a/mythical-creatures/test/hobbit-test.js +++ b/mythical-creatures/test/hobbit-test.js @@ -138,7 +138,7 @@ describe('Hobbit', function() { assert.deepEqual(moreSocialBilbo.acquaintances, [nick, ben, trisha, dustin]); }); - it.skip('should be able to identify which acquaintances are friends ', function() { + it('should be able to identify which acquaintances are friends ', function() { var foster = {name: 'Foster', relationship: 'friend'}; var allie = {name: 'Allie', relationship: 'enemy'}; var garrett = {name: 'Garrett', relationship: 'enemy'}; From d3c40e44ca2d08c33325d11fb9618117cb9eb92e Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:38:25 -0600 Subject: [PATCH 12/64] Create Vampire --- mythical-creatures/exercises/vampire.js | 9 +++++++-- mythical-creatures/test/vampire-test.js | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index 930b9e5cc..8d17e57e0 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -1,7 +1,12 @@ - +function createVampire(name, pet = 'bat') { + return { + name: name, + pet: pet + }; +} module.exports = { - // createVampire, + createVampire, // drink, // findBatLovers, // encounterDeliciousVictim, diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 8cf69f524..b5785c94f 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -3,13 +3,13 @@ var {createVampire, drink, findBatLovers, encounterDeliciousVictim, inquirePlace describe('Vampire', function() { - it.skip('should create a vampire', function() { + it('should create a vampire', function() { var vampire = createVampire('Jhun'); assert.equal(vampire.name, 'Jhun'); }); - it.skip('should have a pet bat as a default', function() { + it('should have a pet bat as a default', function() { var vampire = createVampire('Brittany'); assert.equal(vampire.name, 'Brittany'); From 0fbf350cb42fb856cf479c9fbbd76f5764018446 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:39:00 -0600 Subject: [PATCH 13/64] Add pets --- mythical-creatures/test/vampire-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index b5785c94f..241f6d6ed 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -16,7 +16,7 @@ describe('Vampire', function() { assert.equal(vampire.pet, 'bat'); }); - it.skip('should be able to take an argument for pet', function() { + it('should be able to take an argument for pet', function() { var vampire = createVampire('Jeff', 'fox'); var vampira = createVampire('Esme', 'armadillo'); From 0c729f254f72af7b0438db27e0fe309261dfef2d Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:39:35 -0600 Subject: [PATCH 14/64] Create thirsty --- mythical-creatures/exercises/vampire.js | 3 ++- mythical-creatures/test/vampire-test.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index 8d17e57e0..77cef8586 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -1,7 +1,8 @@ function createVampire(name, pet = 'bat') { return { name: name, - pet: pet + pet: pet, + thirsty: true }; } diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 241f6d6ed..0a39cc195 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -24,7 +24,7 @@ describe('Vampire', function() { assert.equal(vampira.pet, 'armadillo'); }); - it.skip('should be thirsty', function() { + it('should be thirsty', function() { var vampire = createVampire('Andy'); assert.equal(vampire.thirsty, true); From 65280289ece30fd320bb8e04fafe555b11381b9b Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:41:25 -0600 Subject: [PATCH 15/64] Create shout --- mythical-creatures/exercises/vampire.js | 8 +++++++- mythical-creatures/test/vampire-test.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index 77cef8586..cc52441f0 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -6,10 +6,16 @@ function createVampire(name, pet = 'bat') { }; } +function encounterDeliciousVictim(vampire) { + if (vampire.thirsty) { + return 'I WANT TO SUCK YOUR BLOOD!'; + } +} + module.exports = { createVampire, // drink, // findBatLovers, - // encounterDeliciousVictim, + encounterDeliciousVictim, // inquirePlace } \ No newline at end of file diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 0a39cc195..520972339 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -30,7 +30,7 @@ describe('Vampire', function() { assert.equal(vampire.thirsty, true); }); - it.skip('should shout at victim when thirsty', function() { + it('should shout at victim when thirsty', function() { var vampire = createVampire('Andy'); var expectedResponse = 'I WANT TO SUCK YOUR BLOOD!' From 6d4c09a5e403aa2931480fc08f8c064437d4b320 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:42:17 -0600 Subject: [PATCH 16/64] Create ounces drank --- mythical-creatures/exercises/vampire.js | 3 ++- mythical-creatures/test/vampire-test.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index cc52441f0..1085b3a10 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -2,7 +2,8 @@ function createVampire(name, pet = 'bat') { return { name: name, pet: pet, - thirsty: true + thirsty: true, + ouncesDrank: 0 }; } diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 520972339..3033c6b51 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -39,7 +39,7 @@ describe('Vampire', function() { assert.equal(shout, expectedResponse); }); - it.skip('should start with no ounces of blood drank', function() { + it('should start with no ounces of blood drank', function() { assert.equal(createVampire('Bobby').ouncesDrank, 0); }); From 073abb262c4cde2967d2539340a95af9c3752e64 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:43:46 -0600 Subject: [PATCH 17/64] Create drink function --- mythical-creatures/exercises/vampire.js | 7 ++++++- mythical-creatures/test/vampire-test.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index 1085b3a10..c4768e181 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -13,9 +13,14 @@ function encounterDeliciousVictim(vampire) { } } +function drink(vampire) { + vampire.ouncesDrank += 10; + return vampire; +} + module.exports = { createVampire, - // drink, + drink, // findBatLovers, encounterDeliciousVictim, // inquirePlace diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 3033c6b51..7e934bd12 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -43,7 +43,7 @@ describe('Vampire', function() { assert.equal(createVampire('Bobby').ouncesDrank, 0); }); - it.skip('should drink 10 ounces of blood at a time', function() { + it('should drink 10 ounces of blood at a time', function() { var vampire = createVampire('Margot'); var drankOnceVamp = drink(vampire); From 996c588d903c8d53d191beb0734021207084cf7a Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:46:36 -0600 Subject: [PATCH 18/64] Update thirst --- mythical-creatures/exercises/vampire.js | 3 +++ mythical-creatures/test/vampire-test.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index c4768e181..c7b92cce7 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -15,6 +15,9 @@ function encounterDeliciousVictim(vampire) { function drink(vampire) { vampire.ouncesDrank += 10; + if (vampire.ouncesDrank >= 50) { + vampire.thirsty = false; + } return vampire; } diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 7e934bd12..8c850cf86 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -59,7 +59,7 @@ describe('Vampire', function() { assert.equal(drankThriceVamp.ouncesDrank, 30); }); - it.skip('should no longer be thirsty after drinking 50 ounces', function() { + it('should no longer be thirsty after drinking 50 ounces', function() { var vampire = createVampire('Javi'); var drankOnceVamp = drink(vampire); From ba2fb6b4a3b075198d42801fef80ae68966bd331 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:48:45 -0600 Subject: [PATCH 19/64] Limit drinking --- mythical-creatures/exercises/vampire.js | 10 +++++++--- mythical-creatures/test/vampire-test.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index c7b92cce7..89aaf7dfe 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -14,9 +14,13 @@ function encounterDeliciousVictim(vampire) { } function drink(vampire) { - vampire.ouncesDrank += 10; - if (vampire.ouncesDrank >= 50) { - vampire.thirsty = false; + if (vampire.thirsty === false) { + return vampire; + } else { + vampire.ouncesDrank += 10; + if (vampire.ouncesDrank >= 50) { + vampire.thirsty = false; + } } return vampire; } diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 8c850cf86..77a79c800 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -72,7 +72,7 @@ describe('Vampire', function() { assert.equal(drank5xsVamp.thirsty, false); }); - it.skip('should not drink more ounces when not thirsty', function() { + it('should not drink more ounces when not thirsty', function() { var vampire = createVampire('Javi'); var drankOnceVamp = drink(vampire); From 15116f9d7dee5b93647d3f7ca3395f315eb093fb Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:49:45 -0600 Subject: [PATCH 20/64] Refuse victim --- mythical-creatures/exercises/vampire.js | 2 ++ mythical-creatures/test/vampire-test.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index 89aaf7dfe..76ea36885 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -10,6 +10,8 @@ function createVampire(name, pet = 'bat') { function encounterDeliciousVictim(vampire) { if (vampire.thirsty) { return 'I WANT TO SUCK YOUR BLOOD!'; + } else { + return 'No thanks, I am too full.'; } } diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 77a79c800..2371141d7 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -89,7 +89,7 @@ describe('Vampire', function() { assert.equal(notDrinking6xsVamp.ouncesDrank, 50); }); - it.skip('should refuse blood from victim when not thirsty', function() { + it('should refuse blood from victim when not thirsty', function() { var vampire = createVampire('Javi'); var drankOnceVamp = drink(vampire); From b94fe22074b09354b3855fb7139692e1d428a45e Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:54:47 -0600 Subject: [PATCH 21/64] Inquires place --- mythical-creatures/exercises/vampire.js | 11 ++++++++++- mythical-creatures/test/vampire-test.js | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index 76ea36885..58c17d26c 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -27,10 +27,19 @@ function drink(vampire) { return vampire; } +function inquirePlace(locations, place) { + for (var i = 0; i < locations.length; i++) { + if (locations[i] === place) { + return 'Yes, I have spent some time in ' + place + '.'; + } + } + return "No, I have never been to " + place + '.'; +} + module.exports = { createVampire, drink, // findBatLovers, encounterDeliciousVictim, - // inquirePlace + inquirePlace } \ No newline at end of file diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 2371141d7..5c80a104a 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -104,7 +104,7 @@ describe('Vampire', function() { assert.equal(encounterDeliciousVictim(drank5xsVamp), `No thanks, I am too full.`); }); - it.skip('should say if its been to a location', function() { + it('should say if its been to a location', function() { var locations = ['Transylvania', 'Washington', 'New Orleans', 'Mystic Falls']; var response = inquirePlace(locations, 'New Orleans'); From f0ba527a71a0382beb2d8cf80f8b8f1a5f857efd Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:55:11 -0600 Subject: [PATCH 22/64] Declines unvisited place --- mythical-creatures/test/vampire-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 5c80a104a..60ff10d5c 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -113,7 +113,7 @@ describe('Vampire', function() { assert.deepEqual(response, expectedResponse); }); - it.skip('should say if its not been to a location', function() { + it('should say if its not been to a location', function() { var locations = ['Transylvania', 'Washington', 'New Orleans', 'Mystic Falls']; var response = inquirePlace(locations, 'Idaho'); From c9f2c1119012b97e00f75fe152e42feaca2446e9 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 14:57:42 -0600 Subject: [PATCH 23/64] Find bat lovers --- mythical-creatures/exercises/vampire.js | 12 +++++++++++- mythical-creatures/test/vampire-test.js | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mythical-creatures/exercises/vampire.js b/mythical-creatures/exercises/vampire.js index 58c17d26c..8b2f54f09 100644 --- a/mythical-creatures/exercises/vampire.js +++ b/mythical-creatures/exercises/vampire.js @@ -36,10 +36,20 @@ function inquirePlace(locations, place) { return "No, I have never been to " + place + '.'; } +function findBatLovers(vampires) { + var batLovers = []; + for (var i = 0; i < vampires.length; i++) { + if (vampires[i].pet === 'bat') { + batLovers.push(vampires[i].name); + } + } + return batLovers; +} + module.exports = { createVampire, drink, - // findBatLovers, + findBatLovers, encounterDeliciousVictim, inquirePlace } \ No newline at end of file diff --git a/mythical-creatures/test/vampire-test.js b/mythical-creatures/test/vampire-test.js index 60ff10d5c..d96ce254d 100644 --- a/mythical-creatures/test/vampire-test.js +++ b/mythical-creatures/test/vampire-test.js @@ -122,7 +122,7 @@ describe('Vampire', function() { assert.deepEqual(response, expectedResponse); }); - it.skip('should be able to find the vampires with bats', function() { + it('should be able to find the vampires with bats', function() { var javi = createVampire('Javi'); var brittany = createVampire('Brittany'); var jeff = createVampire('Jeff', 'fox'); From b016ea6d89daeaab95f65e37536c8bd5edb8669a Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 15:02:44 -0600 Subject: [PATCH 24/64] Find fire breathers --- mythical-creatures/exercises/dragon.js | 15 ++++++++++----- mythical-creatures/test/dragon-test.js | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mythical-creatures/exercises/dragon.js b/mythical-creatures/exercises/dragon.js index c0b1cbe0b..34b59b287 100644 --- a/mythical-creatures/exercises/dragon.js +++ b/mythical-creatures/exercises/dragon.js @@ -20,14 +20,19 @@ function eat(dragon){ return dragon } -// function findFireBreathers(dragons){ -// var fireBreathers = dragons.find(dragon => dragon.temperament === "aggressive") -// return fireBreathers -// } +function findFireBreathers(dragons){ + var fireBreathers = []; + for (i = 0; i < dragons.length; i++) { + if (dragons[i].temperament == 'aggressive') { + fireBreathers.push(dragons[i]); + } + } + return fireBreathers; +} module.exports = { createDragon, greetRider, eat, - // findFireBreathers + findFireBreathers } \ No newline at end of file diff --git a/mythical-creatures/test/dragon-test.js b/mythical-creatures/test/dragon-test.js index 215974e1d..a01e36752 100644 --- a/mythical-creatures/test/dragon-test.js +++ b/mythical-creatures/test/dragon-test.js @@ -94,7 +94,7 @@ describe('Dragon', function() { }); //Spicy: - it.skip('should be a fireBreather if aggressive in temperament', function() { + it('should be a fireBreather if aggressive in temperament', function() { var dragon1 = createDragon('Gray', 'Marley', 'aggressive'); var dragon2 = createDragon('Sky', 'Susie', 'gentle'); var dragon3 = createDragon('Mushu', 'Mulan', 'aggressive'); From 17dd1144f28c830ebcefbab70cef45d774cded1b Mon Sep 17 00:00:00 2001 From: Kaylah Rose M <111713452+kaylahrose@users.noreply.github.com> Date: Fri, 30 Jun 2023 15:03:37 -0600 Subject: [PATCH 25/64] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f34ee3b5c..c9eaf2eca 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ We find that when students complete the same test suite over and over, memorizat Completing all of these test suites is not necessary, but you should be working on this repo regularly. We see that students are the most successful when they establish a routine for working through these test suites. For example, you might work on them for 45 minutes every morning before class. Find a routine that works best for you and plan ahead so you remain on track to complete the majority of the tests. ### Test Suites -- [ ] 🧚 ‍[Mythical Creatures](./mythical-creatures) +- [x] 🧚 ‍[Mythical Creatures](./mythical-creatures) - [ ] ✈️ [Airport](./airport) - [ ] 🎧 [DJ](./dj) - [ ] 🍔 [Favorite Foods](./favorite-foods) From 5e8fe4095435bd7d181a223ee44a1fbb1e2dd32b Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 15:08:33 -0600 Subject: [PATCH 26/64] Create airports --- airport/airport-test.js | 4 ++-- airport/airport.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/airport/airport-test.js b/airport/airport-test.js index 5c1e20091..5126f53cc 100644 --- a/airport/airport-test.js +++ b/airport/airport-test.js @@ -2,7 +2,7 @@ var assert = require('chai').assert; var { createAirport, welcomeGuests, landPlanes, checkAirlineLocations } = require('./airport'); describe('Airport', function() { - it.skip('should create an airport', function() { + it('should create an airport', function() { var airport = createAirport('Denver International Airport', ['United', 'Southwest', 'Delta'], 144); assert.equal(airport.name, 'Denver International Airport'); @@ -10,7 +10,7 @@ describe('Airport', function() { assert.equal(airport.airlines[0], 'United'); }); - it.skip('should welcome people to the airport', function() { + it('should welcome people to the airport', function() { var denverAirport = createAirport('Denver International Airport', ['United', 'Southwest', 'Delta'], 144); var sanDiegoAirport = createAirport('San Diego International Airport', ['Frontier', 'American'], 48); diff --git a/airport/airport.js b/airport/airport.js index 8966a87f7..b87415051 100644 --- a/airport/airport.js +++ b/airport/airport.js @@ -1,8 +1,14 @@ - +function createAirport(name, airlines, availableGates) { + return { + name: name, + airlines: airlines, + availableGates: availableGates + }; +} module.exports = { - // createAirport, + createAirport, // welcomeGuests, // landPlanes, // checkAirlineLocations From 0a323de7c2ad0e8680a14a6800dc361985899dc6 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 15:10:09 -0600 Subject: [PATCH 27/64] Refactors --- airport/airport.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/airport/airport.js b/airport/airport.js index b87415051..4576dc382 100644 --- a/airport/airport.js +++ b/airport/airport.js @@ -6,10 +6,14 @@ function createAirport(name, airlines, availableGates) { }; } +function welcomeGuests(airport) { + return `Welcome to ${airport.name}!`; +} + module.exports = { createAirport, - // welcomeGuests, + welcomeGuests, // landPlanes, // checkAirlineLocations }; From a01bd9bff141d19c53cf61f13d7b62e8961c21a9 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Fri, 30 Jun 2023 15:12:06 -0600 Subject: [PATCH 28/64] Land planes --- airport/airport-test.js | 2 +- airport/airport.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/airport/airport-test.js b/airport/airport-test.js index 5126f53cc..99a543654 100644 --- a/airport/airport-test.js +++ b/airport/airport-test.js @@ -22,7 +22,7 @@ describe('Airport', function() { assert.equal(sanDiegoWelcome, 'Welcome to San Diego International Airport!'); }); - it.skip('should keep track of open gates', function() { + it('should keep track of open gates', function() { var bakersfieldAirport = createAirport('Meadows Field Airport', ['United', 'American'], 12); var sanDiegoAirport = createAirport('San Diego International Airport', ['Frontier', 'American'], 48); diff --git a/airport/airport.js b/airport/airport.js index 4576dc382..8b24a0a16 100644 --- a/airport/airport.js +++ b/airport/airport.js @@ -10,10 +10,15 @@ function welcomeGuests(airport) { return `Welcome to ${airport.name}!`; } +function landPlanes(airport, gateCount) { + airport.availableGates -= gateCount; + return airport; +} + module.exports = { createAirport, welcomeGuests, - // landPlanes, + landPlanes, // checkAirlineLocations }; From 87156fc365a0f94ea642e8bd736c32618c222c0a Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Thu, 6 Jul 2023 13:21:20 -0600 Subject: [PATCH 29/64] Work on available gates message --- airport/airport-test.js | 3 ++- airport/airport.js | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/airport/airport-test.js b/airport/airport-test.js index 99a543654..e832f06e8 100644 --- a/airport/airport-test.js +++ b/airport/airport-test.js @@ -33,12 +33,13 @@ describe('Airport', function() { assert.equal(sanDiegoGates.availableGates, 46); }); - it.skip('should not be able to occupy more gates than available', function() { + it('should not be able to occupy more gates than available', function() { var columbusAiport = createAirport('John Glenn Airport', ['Southwest', 'Frontier'], 24); var updatedAirportGates = landPlanes(columbusAiport, 22); assert.equal(updatedAirportGates.availableGates, 2); + console.log(updatedAirportGates.message); assert.equal(updatedAirportGates.message, 'Success! Current availability is 2.') var updatedAirportGates2 = landPlanes(updatedAirportGates, 3); diff --git a/airport/airport.js b/airport/airport.js index 8b24a0a16..86e35ecd6 100644 --- a/airport/airport.js +++ b/airport/airport.js @@ -2,19 +2,40 @@ function createAirport(name, airlines, availableGates) { return { name: name, airlines: airlines, - availableGates: availableGates + availableGates: availableGates, + get message() { + if (this.availableGates > 0) { + return `Success! Current availability is ${this.availableGates}.`; + } else { + return `Oh no! Not enough gates available. Current overflow is ${this.availableGates}.`; + } + } }; } + function welcomeGuests(airport) { return `Welcome to ${airport.name}!`; } function landPlanes(airport, gateCount) { airport.availableGates -= gateCount; + if (airport.availableGates < 0) { + airport.availableGates = 0; + } + // airport.message = function() { + // if (this.availableGates > 0) { + // return `Success! Current availability is ${this.availableGates}.`; + // } else { + // return `Oh no! Not enough gates available. Current overflow is ${this.availableGates}.`; + // } + // }; return airport; } +// function checkAvailability(availableGates) { + +// } module.exports = { createAirport, From c44adb931c3832e3da146f5d38e4fc614f456506 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 15:28:00 -0600 Subject: [PATCH 30/64] Create overflow message --- airport/airport.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/airport/airport.js b/airport/airport.js index 86e35ecd6..a93024f76 100644 --- a/airport/airport.js +++ b/airport/airport.js @@ -7,13 +7,12 @@ function createAirport(name, airlines, availableGates) { if (this.availableGates > 0) { return `Success! Current availability is ${this.availableGates}.`; } else { - return `Oh no! Not enough gates available. Current overflow is ${this.availableGates}.`; + return `Oh no! Not enough gates available. Current overflow is ${Math.abs(this.overflow)}.`; } } }; } - function welcomeGuests(airport) { return `Welcome to ${airport.name}!`; } @@ -21,22 +20,12 @@ function welcomeGuests(airport) { function landPlanes(airport, gateCount) { airport.availableGates -= gateCount; if (airport.availableGates < 0) { + airport.overflow = airport.availableGates; airport.availableGates = 0; } - // airport.message = function() { - // if (this.availableGates > 0) { - // return `Success! Current availability is ${this.availableGates}.`; - // } else { - // return `Oh no! Not enough gates available. Current overflow is ${this.availableGates}.`; - // } - // }; return airport; } -// function checkAvailability(availableGates) { - -// } - module.exports = { createAirport, welcomeGuests, From 705d0a06165a552eb72e2c384e21135435cc56f2 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 15:43:18 -0600 Subject: [PATCH 31/64] Check airline locations --- airport/airport-test.js | 2 +- airport/airport.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/airport/airport-test.js b/airport/airport-test.js index e832f06e8..895ef2d40 100644 --- a/airport/airport-test.js +++ b/airport/airport-test.js @@ -48,7 +48,7 @@ describe('Airport', function() { assert.equal(updatedAirportGates2.message, 'Oh no! Not enough gates available. Current overflow is 1.') }); - it.skip('should be able to tell you where an airline flies to', function() { + it('should be able to tell you where an airline flies to', function() { var columbusAiport = createAirport('John Glenn Airport', ['Southwest', 'Frontier'], 24); var bakersfieldAirport = createAirport('Meadows Field Airport', ['United', 'American'], 12); var sanDiegoAirport = createAirport('San Diego International Airport', ['Frontier', 'American'], 48); diff --git a/airport/airport.js b/airport/airport.js index a93024f76..e06cf7e1b 100644 --- a/airport/airport.js +++ b/airport/airport.js @@ -26,9 +26,24 @@ function landPlanes(airport, gateCount) { return airport; } +function checkAirlineLocations(airports, airline) { + const airportsFliesTo = []; + for (i=0; i < airports.length; i++) { + // have a collection of airports and an airline name + // take collection and iterate through each + // if airline is listed in airport.airline, add airport name to new collection + // return collection + if (airports[i].airlines.includes(airline)) { + airportsFliesTo.push(airports[i].name); + // for each airport, check if airline is in airport.airline + } + } + return airportsFliesTo; +} + module.exports = { createAirport, welcomeGuests, landPlanes, - // checkAirlineLocations + checkAirlineLocations }; From 2f6d31a38dfd381b8af55d956bb60f914f7804aa Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 15:43:37 -0600 Subject: [PATCH 32/64] Reformat --- airport/airport.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/airport/airport.js b/airport/airport.js index e06cf7e1b..cbf6f6852 100644 --- a/airport/airport.js +++ b/airport/airport.js @@ -29,13 +29,8 @@ function landPlanes(airport, gateCount) { function checkAirlineLocations(airports, airline) { const airportsFliesTo = []; for (i=0; i < airports.length; i++) { - // have a collection of airports and an airline name - // take collection and iterate through each - // if airline is listed in airport.airline, add airport name to new collection - // return collection if (airports[i].airlines.includes(airline)) { airportsFliesTo.push(airports[i].name); - // for each airport, check if airline is in airport.airline } } return airportsFliesTo; From d80b455129844f516b54e21b80ac9899faf0c017 Mon Sep 17 00:00:00 2001 From: Kaylah Rose M <111713452+kaylahrose@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:44:59 -0600 Subject: [PATCH 33/64] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9eaf2eca..43de70fd2 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Completing all of these test suites is not necessary, but you should be working ### Test Suites - [x] 🧚 ‍[Mythical Creatures](./mythical-creatures) -- [ ] ✈️ [Airport](./airport) +- [x] ✈️ [Airport](./airport) - [ ] 🎧 [DJ](./dj) - [ ] 🍔 [Favorite Foods](./favorite-foods) - [ ] 🎮 [Video Games](./video-games/) From 8d32f01985c25f742a611bcce497a5565efcd716 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 15:50:11 -0600 Subject: [PATCH 34/64] Create songs --- dj/dj-test.js | 2 +- dj/dj.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dj/dj-test.js b/dj/dj-test.js index 68fdbb654..68faa119e 100644 --- a/dj/dj-test.js +++ b/dj/dj-test.js @@ -2,7 +2,7 @@ var { createSong, playSong, makePlaylist, addSongToPlaylist, playSongs, playFavo var assert = require('chai').assert; describe('dj', function() { - it.skip('should be able to create songs', function() { + it('should be able to create songs', function() { var song = createSong('Zombie Shuffle', 'The Creepy Crawlers', true) assert.equal(song.name, 'Zombie Shuffle'); diff --git a/dj/dj.js b/dj/dj.js index cc8947f70..25df80e95 100644 --- a/dj/dj.js +++ b/dj/dj.js @@ -1,6 +1,13 @@ +function createSong(name, artist, favorite) { + return { + name: name, + artist: artist, + favorite: favorite, + } +} module.exports = { - // createSong, + createSong, // playSong, // makePlaylist, // addSongToPlaylist, From e39a53161c73269ec634bb0d978e3e032246db0e Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 15:52:22 -0600 Subject: [PATCH 35/64] Create has been played status --- dj/dj-test.js | 2 +- dj/dj.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dj/dj-test.js b/dj/dj-test.js index 68faa119e..581d61156 100644 --- a/dj/dj-test.js +++ b/dj/dj-test.js @@ -10,7 +10,7 @@ describe('dj', function() { assert.equal(song.favorite, true); }) - it.skip('should not have been played by default', function() { + it('should not have been played by default', function() { var song = createSong('Witches\' Brew Boogie', 'The Ghostly Ghouls', true) assert.equal(song.name, 'Witches\' Brew Boogie'); diff --git a/dj/dj.js b/dj/dj.js index 25df80e95..49e402cba 100644 --- a/dj/dj.js +++ b/dj/dj.js @@ -3,6 +3,7 @@ function createSong(name, artist, favorite) { name: name, artist: artist, favorite: favorite, + hasBeenPlayed: false, } } From 24faeaeadc48d84c82328d9935b604714cc988f5 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 15:53:10 -0600 Subject: [PATCH 36/64] Create default favorite status --- dj/dj-test.js | 2 +- dj/dj.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dj/dj-test.js b/dj/dj-test.js index 581d61156..11d9dba8a 100644 --- a/dj/dj-test.js +++ b/dj/dj-test.js @@ -19,7 +19,7 @@ describe('dj', function() { assert.equal(song.hasBeenPlayed, false); }) - it.skip('should not be a favorite by default', function() { + it('should not be a favorite by default', function() { var song = createSong('Witches\' Brew Boogie', 'The Ghostly Ghouls') assert.equal(song.favorite, false); diff --git a/dj/dj.js b/dj/dj.js index 49e402cba..8616f6e0e 100644 --- a/dj/dj.js +++ b/dj/dj.js @@ -1,4 +1,4 @@ -function createSong(name, artist, favorite) { +function createSong(name, artist, favorite = false) { return { name: name, artist: artist, From bf03c493e04dc806deb6ccb17269f29753933275 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 15:55:22 -0600 Subject: [PATCH 37/64] Plays song --- dj/dj-test.js | 2 +- dj/dj.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dj/dj-test.js b/dj/dj-test.js index 11d9dba8a..549a2e588 100644 --- a/dj/dj-test.js +++ b/dj/dj-test.js @@ -26,7 +26,7 @@ describe('dj', function() { }) - it.skip('should be able to play a song', function() { + it('should be able to play a song', function() { var song = createSong('I Put A Spell On You', 'Bette Midler, Sarah Jessica Parker & Kathy Najimy') assert.equal(song.name, 'I Put A Spell On You'); diff --git a/dj/dj.js b/dj/dj.js index 8616f6e0e..5c71a5a53 100644 --- a/dj/dj.js +++ b/dj/dj.js @@ -7,9 +7,14 @@ function createSong(name, artist, favorite = false) { } } +function playSong(song) { + song.hasBeenPlayed=true; + return song; +} + module.exports = { createSong, - // playSong, + playSong, // makePlaylist, // addSongToPlaylist, // playSongs From 0a8fa8fef26409bac6e5b25a6cba9fb31443a0fa Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 15:56:41 -0600 Subject: [PATCH 38/64] Make playlists --- dj/dj-test.js | 2 +- dj/dj.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dj/dj-test.js b/dj/dj-test.js index 549a2e588..308229bdd 100644 --- a/dj/dj-test.js +++ b/dj/dj-test.js @@ -39,7 +39,7 @@ describe('dj', function() { assert.equal(playedSong.hasBeenPlayed, true); }) - it.skip('should be able to create a playlist', function() { + it('should be able to create a playlist', function() { var skeletonSong = createSong('Skeletons in the Closet Rock', 'The Skeletal Band'); var tangoTrack = createSong('Trick or Treat Tango', 'The Spooky Cats'); diff --git a/dj/dj.js b/dj/dj.js index 5c71a5a53..ac570f257 100644 --- a/dj/dj.js +++ b/dj/dj.js @@ -12,10 +12,17 @@ function playSong(song) { return song; } +function makePlaylist(name, songs) { + return { + name: name, + songs: songs, + } +} + module.exports = { createSong, playSong, - // makePlaylist, + makePlaylist, // addSongToPlaylist, // playSongs }; From b450ccd3b6ad5fef78112cb3a24b8b4f8a402155 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 16:35:36 -0600 Subject: [PATCH 39/64] Play playlists --- dj/dj-test.js | 2 +- dj/dj.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dj/dj-test.js b/dj/dj-test.js index 308229bdd..7d6ef6764 100644 --- a/dj/dj-test.js +++ b/dj/dj-test.js @@ -64,7 +64,7 @@ describe('dj', function() { assert.deepEqual(updatedHolidayPlaylist.songs, [jingleJive, funkyFrosty]) }) - it.skip('should be able to play all the songs', function() { + it('should be able to play all the songs', function() { var rockinSong = createSong('Rockin\' Around the Christmas Treehouse', 'The Yuletide Youth'); var shuffleSong = createSong('Santa\'s Sleigh Ride Shuffle', 'The Jolly Jinglesters') var reggaeSong = createSong('Rudolph\'s Reggae Jam', 'The Reindeer Rhythms') diff --git a/dj/dj.js b/dj/dj.js index ac570f257..2fb5d8f76 100644 --- a/dj/dj.js +++ b/dj/dj.js @@ -19,10 +19,17 @@ function makePlaylist(name, songs) { } } +function playSongs(playlist) { + for (var i = 0; i < playlist.songs.length; i++) { + playSong(playlist.songs[i]); + } + return playlist; +} + module.exports = { createSong, playSong, makePlaylist, // addSongToPlaylist, - // playSongs + playSongs }; From 2a95edb1018cbbc5ebc32b7fff9882c10767b67e Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 16:38:52 -0600 Subject: [PATCH 40/64] Add song to playlist --- dj/dj-test.js | 2 +- dj/dj.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dj/dj-test.js b/dj/dj-test.js index 7d6ef6764..441a767be 100644 --- a/dj/dj-test.js +++ b/dj/dj-test.js @@ -49,7 +49,7 @@ describe('dj', function() { assert.deepEqual(playlist.songs, [skeletonSong, tangoTrack]) }) - it.skip('should be able to add songs to a playlist', function() { + it('should be able to add songs to a playlist', function() { var jingleJive = createSong('Jingle Bell Jive', 'The Dancing Elves'); var holidayPlaylist = makePlaylist('Holiday Songs', [jingleJive]); diff --git a/dj/dj.js b/dj/dj.js index 2fb5d8f76..dd65fc90e 100644 --- a/dj/dj.js +++ b/dj/dj.js @@ -19,6 +19,11 @@ function makePlaylist(name, songs) { } } +function addSongToPlaylist(playlist, song) { + playlist.songs.push(song); + return playlist +} + function playSongs(playlist) { for (var i = 0; i < playlist.songs.length; i++) { playSong(playlist.songs[i]); @@ -30,6 +35,6 @@ module.exports = { createSong, playSong, makePlaylist, - // addSongToPlaylist, + addSongToPlaylist, playSongs }; From f94d6783d653a6439f00e3a37d574655211c3cb6 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 16:46:50 -0600 Subject: [PATCH 41/64] Play favorites --- dj/dj-test.js | 2 +- dj/dj.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dj/dj-test.js b/dj/dj-test.js index 441a767be..2f5040063 100644 --- a/dj/dj-test.js +++ b/dj/dj-test.js @@ -78,7 +78,7 @@ describe('dj', function() { assert.equal(updatedHolidayPlaylist.songs[2].hasBeenPlayed, true) }) - it.skip('should be able to play only the favorites if specified', function() { + it('should be able to play only the favorites if specified', function() { var rockinSong = createSong('Rockin\' Around the Christmas Treehouse', 'The Yuletide Youth', true); var shuffleSong = createSong('Santa\'s Sleigh Ride Shuffle', 'The Jolly Jinglesters') var reggaeSong = createSong('Rudolph\'s Reggae Jam', 'The Reindeer Rhythms', true) diff --git a/dj/dj.js b/dj/dj.js index dd65fc90e..2e8f379ab 100644 --- a/dj/dj.js +++ b/dj/dj.js @@ -24,9 +24,17 @@ function addSongToPlaylist(playlist, song) { return playlist } -function playSongs(playlist) { - for (var i = 0; i < playlist.songs.length; i++) { - playSong(playlist.songs[i]); +function playSongs(playlist, specs) { + if (specs) { + for (var i = 0; i < playlist.songs.length; i++) { + if (playlist.songs[i].favorite) { + playSong(playlist.songs[i]); + } + } + } else { + for (var i = 0; i < playlist.songs.length; i++) { + playSong(playlist.songs[i]); + } } return playlist; } From 014c366d913ed10872c7b9cbb8e3aae150284d26 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 16:48:04 -0600 Subject: [PATCH 42/64] Update RED --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 43de70fd2..bed2c3968 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Completing all of these test suites is not necessary, but you should be working ### Test Suites - [x] 🧚 ‍[Mythical Creatures](./mythical-creatures) - [x] ✈️ [Airport](./airport) -- [ ] 🎧 [DJ](./dj) +- [x] 🎧 [DJ](./dj) - [ ] 🍔 [Favorite Foods](./favorite-foods) - [ ] 🎮 [Video Games](./video-games/) - [ ] 🎂 [Birthdays](./birthdays) From afb1f012c2bfcbc81483948af791c5e3c20f438a Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 16:54:16 -0600 Subject: [PATCH 43/64] Create favorite food --- favorite-foods/favorite-foods-test.js | 2 +- favorite-foods/favorite-foods.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/favorite-foods/favorite-foods-test.js b/favorite-foods/favorite-foods-test.js index bc5f7985b..4fe59ab25 100644 --- a/favorite-foods/favorite-foods-test.js +++ b/favorite-foods/favorite-foods-test.js @@ -2,7 +2,7 @@ var { createFavoriteFood } = require('./favorite-foods'); var assert = require('chai').assert; describe('favorite foods', function () { - it.skip('should create a new dish with a name', function () { + it('should create a new dish with a name', function () { var pizza = createFavoriteFood({ dish: 'Pizza' }); assert.equal(pizza.name, 'Pizza'); diff --git a/favorite-foods/favorite-foods.js b/favorite-foods/favorite-foods.js index 5f93c3872..b9b3395d6 100644 --- a/favorite-foods/favorite-foods.js +++ b/favorite-foods/favorite-foods.js @@ -1,4 +1,10 @@ +function createFavoriteFood(dish) { + return { + name: dish.dish + } +} - -module.exports = { }; \ No newline at end of file +module.exports = { + createFavoriteFood + }; \ No newline at end of file From f48c62a5e89f753700b799a505c2366b4d7ce403 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 16:55:26 -0600 Subject: [PATCH 44/64] Create ingredients --- favorite-foods/favorite-foods-test.js | 4 ++-- favorite-foods/favorite-foods.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/favorite-foods/favorite-foods-test.js b/favorite-foods/favorite-foods-test.js index 4fe59ab25..be38b3190 100644 --- a/favorite-foods/favorite-foods-test.js +++ b/favorite-foods/favorite-foods-test.js @@ -8,13 +8,13 @@ describe('favorite foods', function () { assert.equal(pizza.name, 'Pizza'); }); - it.skip('should be able to create a different dish', function () { + it('should be able to create a different dish', function () { var smoothie = createFavoriteFood({ dish: 'Smoothie' }); assert.equal(smoothie.name, 'Smoothie'); }); - it.skip('should have ingredients', function () { + it('should have ingredients', function () { var tacos = createFavoriteFood({ dish: 'Tacos', ingredients: ['Tortilla', 'Ground Beef', 'Lettuce', 'Tomatoes', 'Sour Cream', 'Salsa'] }); assert.equal(tacos.name, 'Tacos'); diff --git a/favorite-foods/favorite-foods.js b/favorite-foods/favorite-foods.js index b9b3395d6..6350e837f 100644 --- a/favorite-foods/favorite-foods.js +++ b/favorite-foods/favorite-foods.js @@ -1,6 +1,7 @@ function createFavoriteFood(dish) { return { - name: dish.dish + name: dish.dish, + ingredients: dish.ingredients } } From f84e2ec68dcb68171820597218d85307db95379b Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 16:57:57 -0600 Subject: [PATCH 45/64] Add spicy status --- favorite-foods/favorite-foods-test.js | 4 ++-- favorite-foods/favorite-foods.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/favorite-foods/favorite-foods-test.js b/favorite-foods/favorite-foods-test.js index be38b3190..2a52fb768 100644 --- a/favorite-foods/favorite-foods-test.js +++ b/favorite-foods/favorite-foods-test.js @@ -21,7 +21,7 @@ describe('favorite foods', function () { assert.deepEqual(tacos.ingredients, ['Tortilla', 'Ground Beef', 'Lettuce', 'Tomatoes', 'Sour Cream', 'Salsa']); }); - it.skip('should be able to have different ingredients', function () { + it('should be able to have different ingredients', function () { var burger = createFavoriteFood({ dish: 'Burger', ingredients: ['Bun', 'Beef Patty', 'Lettuce', 'Tomato', 'Cheese', 'Ketchup', 'Mustard'] }); var sushi = createFavoriteFood({ dish: 'Sushi', ingredients: ['Rice', 'Salmon', 'Tuna', 'Avocado', 'Cucumber', 'Soy Sauce', 'Wasabi'] }); @@ -32,7 +32,7 @@ describe('favorite foods', function () { assert.deepEqual(sushi.ingredients, ['Rice', 'Salmon', 'Tuna', 'Avocado', 'Cucumber', 'Soy Sauce', 'Wasabi']); }); - it.skip('should be spicy or not', function () { + it('should be spicy or not', function () { var pancakes = createFavoriteFood({ dish: 'Pancakes', ingredients: ['Flour', 'Egg', 'Milk', 'Butter', 'Maple Syrup'], isSpicy: false }); var padThai = createFavoriteFood({ dish: 'Pad Thai', ingredients: ['Rice Noodles', 'Shrimp', 'Tofu', 'Egg', 'Bean Sprouts', 'Peanuts', 'Lime'], isSpicy: true }); diff --git a/favorite-foods/favorite-foods.js b/favorite-foods/favorite-foods.js index 6350e837f..d7a54a85f 100644 --- a/favorite-foods/favorite-foods.js +++ b/favorite-foods/favorite-foods.js @@ -1,7 +1,8 @@ function createFavoriteFood(dish) { return { name: dish.dish, - ingredients: dish.ingredients + ingredients: dish.ingredients, + isSpicy: dish.isSpicy } } From 9fde00ae7712966b080d1f18c897ea2cad5b3c2e Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:01:40 -0600 Subject: [PATCH 46/64] Comment on spiciness --- favorite-foods/favorite-foods-test.js | 4 ++-- favorite-foods/favorite-foods.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/favorite-foods/favorite-foods-test.js b/favorite-foods/favorite-foods-test.js index 2a52fb768..e1a9153c3 100644 --- a/favorite-foods/favorite-foods-test.js +++ b/favorite-foods/favorite-foods-test.js @@ -1,4 +1,4 @@ -var { createFavoriteFood } = require('./favorite-foods'); +var { createFavoriteFood, commentOnSpiciness } = require('./favorite-foods'); var assert = require('chai').assert; describe('favorite foods', function () { @@ -45,7 +45,7 @@ describe('favorite foods', function () { assert.equal(padThai.isSpicy, true); }); - it.skip('should be able to taste the food and comment on how spicy it is', function () { + it('should be able to taste the food and comment on how spicy it is', function () { var dish1 = createFavoriteFood({ dish: 'Pho', ingredients: ['Rice Noodles', 'Beef', 'Bean Sprouts', 'Basil', 'Lime', 'Sriracha'], isSpicy: true }); var dish2 = createFavoriteFood({ dish: 'Lasagna', ingredients: ['Lasagna Noodles', 'Ground Beef', 'Tomato Sauce', 'Ricotta Cheese', 'Mozzarella Cheese'], isSpicy: false }); diff --git a/favorite-foods/favorite-foods.js b/favorite-foods/favorite-foods.js index d7a54a85f..1f76c179c 100644 --- a/favorite-foods/favorite-foods.js +++ b/favorite-foods/favorite-foods.js @@ -6,7 +6,16 @@ function createFavoriteFood(dish) { } } +function commentOnSpiciness(dish) { + if (dish.isSpicy) { + return `Wow, this ${dish.name} is so spicy!` + } else { + return `Phew, this ${dish.name} is not very spicy.` + } +} + module.exports = { - createFavoriteFood + createFavoriteFood, + commentOnSpiciness, }; \ No newline at end of file From aa10c921de063bf0ac352bfbbe7bf937b0d1a8e1 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:02:33 -0600 Subject: [PATCH 47/64] Create default order count --- favorite-foods/favorite-foods-test.js | 2 +- favorite-foods/favorite-foods.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/favorite-foods/favorite-foods-test.js b/favorite-foods/favorite-foods-test.js index e1a9153c3..6f01a823d 100644 --- a/favorite-foods/favorite-foods-test.js +++ b/favorite-foods/favorite-foods-test.js @@ -56,7 +56,7 @@ describe('favorite foods', function () { assert.equal(comment2, 'Phew, this Lasagna is not very spicy.'); }); - it.skip('should start off having ordered 0 times', function () { + it('should start off having ordered 0 times', function () { var dish = createFavoriteFood('Falafel', ['Chickpeas', 'Garlic', 'Onion', 'Cumin', 'Tahini', 'Pita Bread'], true); assert.equal(dish.timesOrdered, 0); diff --git a/favorite-foods/favorite-foods.js b/favorite-foods/favorite-foods.js index 1f76c179c..0a3e7a990 100644 --- a/favorite-foods/favorite-foods.js +++ b/favorite-foods/favorite-foods.js @@ -2,7 +2,8 @@ function createFavoriteFood(dish) { return { name: dish.dish, ingredients: dish.ingredients, - isSpicy: dish.isSpicy + isSpicy: dish.isSpicy, + timesOrdered: 0 } } From 0b38a7173964edad059cdf41e0609fd101060352 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:03:58 -0600 Subject: [PATCH 48/64] Order dish --- favorite-foods/favorite-foods-test.js | 4 ++-- favorite-foods/favorite-foods.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/favorite-foods/favorite-foods-test.js b/favorite-foods/favorite-foods-test.js index 6f01a823d..27316aa2f 100644 --- a/favorite-foods/favorite-foods-test.js +++ b/favorite-foods/favorite-foods-test.js @@ -1,4 +1,4 @@ -var { createFavoriteFood, commentOnSpiciness } = require('./favorite-foods'); +var { createFavoriteFood, commentOnSpiciness, orderFood } = require('./favorite-foods'); var assert = require('chai').assert; describe('favorite foods', function () { @@ -62,7 +62,7 @@ describe('favorite foods', function () { assert.equal(dish.timesOrdered, 0); }); - it.skip('should be able to order dishes', function () { + it('should be able to order dishes', function () { var dish1 = createFavoriteFood({ dish: 'Fish and Chips', ingredients: ['Fish Fillet', 'Potatoes', 'Flour', 'Egg', 'Beer', 'Tartar Sauce'], isSpicy: false }); var dish2 = createFavoriteFood({ dish: 'Chicken Curry', ingredients: ['Chicken', 'Coconut Milk', 'Onion', 'Garlic', 'Rice'], isSpicy: true }); var dish3 = createFavoriteFood({ dish: 'Ice Cream', ingredients: ['Milk', 'Cream', 'Sugar', 'Vanilla Extract', 'Chocolate Chips'], isSpicy: false }); diff --git a/favorite-foods/favorite-foods.js b/favorite-foods/favorite-foods.js index 0a3e7a990..0eaccbab9 100644 --- a/favorite-foods/favorite-foods.js +++ b/favorite-foods/favorite-foods.js @@ -15,8 +15,14 @@ function commentOnSpiciness(dish) { } } +function orderFood(dish) { + dish.timesOrdered +=1; + return dish +} + module.exports = { createFavoriteFood, commentOnSpiciness, + orderFood }; \ No newline at end of file From 93ee7d8f8777a2792906565c4fd965d92f777bd0 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:08:31 -0600 Subject: [PATCH 49/64] Create shopping list --- favorite-foods/favorite-foods-test.js | 4 ++-- favorite-foods/favorite-foods.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/favorite-foods/favorite-foods-test.js b/favorite-foods/favorite-foods-test.js index 27316aa2f..472df8929 100644 --- a/favorite-foods/favorite-foods-test.js +++ b/favorite-foods/favorite-foods-test.js @@ -1,4 +1,4 @@ -var { createFavoriteFood, commentOnSpiciness, orderFood } = require('./favorite-foods'); +var { createFavoriteFood, commentOnSpiciness, orderFood, createShoppingList } = require('./favorite-foods'); var assert = require('chai').assert; describe('favorite foods', function () { @@ -81,7 +81,7 @@ describe('favorite foods', function () { }) // spicy 🌶️ - it.skip('should be able to make a list of all ingredients needed for multiple dishes', function () { + it('should be able to make a list of all ingredients needed for multiple dishes', function () { var pizza = createFavoriteFood({ dish: 'Pizza', ingredients: ['Tomato Sauce', 'Cheese', 'Pepperoni', 'Mushrooms'], isSpicy: false }); var smoothie = createFavoriteFood({ dish: 'Smoothie', ingredients: ['Banana', 'Strawberry', 'Blueberry', 'Milk', 'Honey'], isSpicy: false }) diff --git a/favorite-foods/favorite-foods.js b/favorite-foods/favorite-foods.js index 0eaccbab9..ae2d603c1 100644 --- a/favorite-foods/favorite-foods.js +++ b/favorite-foods/favorite-foods.js @@ -20,9 +20,18 @@ function orderFood(dish) { return dish } +function createShoppingList(dishes) { + const list = []; + for (i = 0; i < dishes.length; i++) { + list.push(dishes[i].ingredients); + } + return list.flat() +} + module.exports = { createFavoriteFood, commentOnSpiciness, - orderFood + orderFood, + createShoppingList }; \ No newline at end of file From 2550948f143b2968fb103bc2439c8beafb3d9d9a Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:09:02 -0600 Subject: [PATCH 50/64] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bed2c3968..efc4f4204 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Completing all of these test suites is not necessary, but you should be working - [x] 🧚 ‍[Mythical Creatures](./mythical-creatures) - [x] ✈️ [Airport](./airport) - [x] 🎧 [DJ](./dj) -- [ ] 🍔 [Favorite Foods](./favorite-foods) +- [x] 🍔 [Favorite Foods](./favorite-foods) - [ ] 🎮 [Video Games](./video-games/) - [ ] 🎂 [Birthdays](./birthdays) - [ ] 🗓 [Calendar](./calendar/) From 33f350c1c1f2dfb89cdb3b834796edc7f423221d Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:12:51 -0600 Subject: [PATCH 51/64] Create player --- video-games/video-games-test.js | 2 +- video-games/video-games.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/video-games/video-games-test.js b/video-games/video-games-test.js index fab2d6908..95d2f2535 100644 --- a/video-games/video-games-test.js +++ b/video-games/video-games-test.js @@ -2,7 +2,7 @@ var { createPlayer } = require('./video-games'); var assert = require('chai').assert; describe('video games', function () { - it.skip('should create a new player with a name and an age', function () { + it('should create a new player with a name and an age', function () { var player1 = createPlayer('Ace Skateboarder', 19); assert.equal(player1.name, 'Ace Skateboarder'); diff --git a/video-games/video-games.js b/video-games/video-games.js index 5f93c3872..496a3dff6 100644 --- a/video-games/video-games.js +++ b/video-games/video-games.js @@ -1,4 +1,11 @@ +function createPlayer(name, age) { + return { + name: name, + age: age + } +} - -module.exports = { }; \ No newline at end of file +module.exports = { + createPlayer +}; \ No newline at end of file From 4184b7631d220153f0e3a02406bf168161b26722 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:14:19 -0600 Subject: [PATCH 52/64] Create moveset --- video-games/video-games-test.js | 4 ++-- video-games/video-games.js | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/video-games/video-games-test.js b/video-games/video-games-test.js index 95d2f2535..20551c94b 100644 --- a/video-games/video-games-test.js +++ b/video-games/video-games-test.js @@ -9,7 +9,7 @@ describe('video games', function () { assert.equal(player1.age, 19); }); - it.skip('should create another player with a name and an age', function () { + it('should create another player with a name and an age', function () { var player1 = createPlayer('Guitar Heroine', 25); var player2 = createPlayer('Time Traveler', 35); @@ -19,7 +19,7 @@ describe('video games', function () { assert.equal(player2.age, 35); }); - it.skip('should create a new player with a unique moveset', function () { + it('should create a new player with a unique moveset', function () { var player1 = createPlayer('Super Skater', 27, ['super jump', 'board smash', 'grind rail']); assert.equal(player1.name, 'Super Skater'); diff --git a/video-games/video-games.js b/video-games/video-games.js index 496a3dff6..ccc58797d 100644 --- a/video-games/video-games.js +++ b/video-games/video-games.js @@ -1,7 +1,8 @@ -function createPlayer(name, age) { +function createPlayer(name, age, moveset) { return { name: name, - age: age + age: age, + moveset: moveset } } From efc3cb29744662faa7445487415edc1c865a81f7 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:15:26 -0600 Subject: [PATCH 53/64] Create level --- video-games/video-games-test.js | 4 ++-- video-games/video-games.js | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/video-games/video-games-test.js b/video-games/video-games-test.js index 20551c94b..d336b6244 100644 --- a/video-games/video-games-test.js +++ b/video-games/video-games-test.js @@ -1,4 +1,4 @@ -var { createPlayer } = require('./video-games'); +var { createPlayer, createLevel } = require('./video-games'); var assert = require('chai').assert; describe('video games', function () { @@ -27,7 +27,7 @@ describe('video games', function () { assert.deepEqual(player1.moveset['super jump', 'board smash', 'grind rail']); }); - it.skip('should be able to create a new level with a name', function () { + it('should be able to create a new level with a name', function () { var level = createLevel('Island Oasis'); assert.equal(level.name, 'Island Oasis'); diff --git a/video-games/video-games.js b/video-games/video-games.js index ccc58797d..4e2967ff1 100644 --- a/video-games/video-games.js +++ b/video-games/video-games.js @@ -6,7 +6,14 @@ function createPlayer(name, age, moveset) { } } +function createLevel(name) { + return{ + name: name + } +} + module.exports = { - createPlayer + createPlayer, + createLevel }; \ No newline at end of file From 52ec3e984a9af5c848443294c07a21dcf9998b0c Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:16:47 -0600 Subject: [PATCH 54/64] Add players to level --- video-games/video-games-test.js | 2 +- video-games/video-games.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/video-games/video-games-test.js b/video-games/video-games-test.js index d336b6244..9f16b7468 100644 --- a/video-games/video-games-test.js +++ b/video-games/video-games-test.js @@ -33,7 +33,7 @@ describe('video games', function () { assert.equal(level.name, 'Island Oasis'); }); - it.skip('should be able to create a new level with a name and a player', function () { + it('should be able to create a new level with a name and a player', function () { var player1 = createPlayer('The Future Savior', 18, ['time travel', 'combat training', 'futuristic weapon']); var level = createLevel('Zombie Infested City', [player1]); diff --git a/video-games/video-games.js b/video-games/video-games.js index 4e2967ff1..9c64119d9 100644 --- a/video-games/video-games.js +++ b/video-games/video-games.js @@ -6,9 +6,10 @@ function createPlayer(name, age, moveset) { } } -function createLevel(name) { +function createLevel(name, players) { return{ - name: name + name: name, + players: players } } From e7fe042ae3c0e6d8592fa5f44760ac7f8fa8cecb Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:17:49 -0600 Subject: [PATCH 55/64] Add coins and lives to level --- video-games/video-games-test.js | 4 ++-- video-games/video-games.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/video-games/video-games-test.js b/video-games/video-games-test.js index 9f16b7468..2a2167d0b 100644 --- a/video-games/video-games-test.js +++ b/video-games/video-games-test.js @@ -41,7 +41,7 @@ describe('video games', function () { assert.deepEqual(level.players, [player1]); }); - it.skip('should be able to create a new level with a name and many players', function () { + it('should be able to create a new level with a name and many players', function () { var player1 = createPlayer('Rock Star Rebel', 21, ['power chord', 'stage dive', 'crowd surf']); var player2 = createPlayer('Pro Skater Prodigy', 16, ['360 flip', 'board slide', 'gap transfer']); var level = createLevel('Candy Cane Canyon', [player1, player2]); @@ -50,7 +50,7 @@ describe('video games', function () { assert.deepEqual(level.players, [player1, player2]); }); - it.skip('should initiate a level with a player and 3 lives and 0 coins', function () { + it('should initiate a level with a player and 3 lives and 0 coins', function () { var player1 = createPlayer('Quantum Jumper', 30, ['dimension jump', 'portal creation', 'alternate reality explosion']); var level = createLevel('Carnival of Terror', [player1]); diff --git a/video-games/video-games.js b/video-games/video-games.js index 9c64119d9..b4baa5b5c 100644 --- a/video-games/video-games.js +++ b/video-games/video-games.js @@ -9,7 +9,9 @@ function createPlayer(name, age, moveset) { function createLevel(name, players) { return{ name: name, - players: players + players: players, + coins: 0, + lives: 3 } } From fef9f283a2f0c2364d257884e7dcf9a52d216eba Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:20:11 -0600 Subject: [PATCH 56/64] Find coins --- video-games/video-games-test.js | 4 ++-- video-games/video-games.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/video-games/video-games-test.js b/video-games/video-games-test.js index 2a2167d0b..5632bcafd 100644 --- a/video-games/video-games-test.js +++ b/video-games/video-games-test.js @@ -1,4 +1,4 @@ -var { createPlayer, createLevel } = require('./video-games'); +var { createPlayer, createLevel, findCoins } = require('./video-games'); var assert = require('chai').assert; describe('video games', function () { @@ -60,7 +60,7 @@ describe('video games', function () { assert.equal(level.lives, 3); }); - it.skip('should be able to collect coins', function () { + it('should be able to collect coins', function () { var player1 = createPlayer('The Timeless Troubadour', 500, ['piano sonata', 'violin concerto', 'fllamenco guitar']); var level = createLevel('Infernal Inferno of Flames', [player1]); diff --git a/video-games/video-games.js b/video-games/video-games.js index b4baa5b5c..d705f9645 100644 --- a/video-games/video-games.js +++ b/video-games/video-games.js @@ -15,8 +15,13 @@ function createLevel(name, players) { } } +function findCoins(level, coinCount) { + level.coins = coinCount; + return level +} module.exports = { createPlayer, - createLevel + createLevel, + findCoins }; \ No newline at end of file From b9aa7a0d6e516929899455d996a2c7a79a25ce3d Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:22:14 -0600 Subject: [PATCH 57/64] Add life after coins collected --- video-games/video-games-test.js | 2 +- video-games/video-games.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/video-games/video-games-test.js b/video-games/video-games-test.js index 5632bcafd..8092edc1c 100644 --- a/video-games/video-games-test.js +++ b/video-games/video-games-test.js @@ -73,7 +73,7 @@ describe('video games', function () { assert.equal(updatedLevel.coins, 5); }); - it.skip('should add a life when 100 coins are collected', function () { + it('should add a life when 100 coins are collected', function () { var player1 = createPlayer('The Fiery Friar', 50, ['flame spin', 'fire dance', 'smoke screen']); var level = createLevel('Water Temple', [player1]); diff --git a/video-games/video-games.js b/video-games/video-games.js index d705f9645..5f54cb057 100644 --- a/video-games/video-games.js +++ b/video-games/video-games.js @@ -17,6 +17,9 @@ function createLevel(name, players) { function findCoins(level, coinCount) { level.coins = coinCount; + if (level.coins >= 100) { + level.lives += 1; + } return level } From dadcc52ebe5d6be6b2e02595c4d72acc3d92253b Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:24:03 -0600 Subject: [PATCH 58/64] Defeat player --- video-games/video-games-test.js | 4 ++-- video-games/video-games.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/video-games/video-games-test.js b/video-games/video-games-test.js index 8092edc1c..338656235 100644 --- a/video-games/video-games-test.js +++ b/video-games/video-games-test.js @@ -1,4 +1,4 @@ -var { createPlayer, createLevel, findCoins } = require('./video-games'); +var { createPlayer, createLevel, findCoins, defeatPlayer } = require('./video-games'); var assert = require('chai').assert; describe('video games', function () { @@ -87,7 +87,7 @@ describe('video games', function () { assert.equal(level.lives, 4); }); - it.skip('should be able to defeat the player and cost a life', function () { + it('should be able to defeat the player and cost a life', function () { var player1 = createPlayer('Tony Thrasher', 34, ['thrash throw', 'solving mysteries', 'thrash dance']); var level = createLevel('Alien Outpost', [player1]); diff --git a/video-games/video-games.js b/video-games/video-games.js index 5f54cb057..fbc6849f4 100644 --- a/video-games/video-games.js +++ b/video-games/video-games.js @@ -23,8 +23,14 @@ function findCoins(level, coinCount) { return level } +function defeatPlayer(level) { + level.lives -= 1; + return level +} + module.exports = { createPlayer, createLevel, - findCoins + findCoins, + defeatPlayer }; \ No newline at end of file From 92856797bbaba88eb39e3a26182b1ca000b00382 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:25:20 -0600 Subject: [PATCH 59/64] Print game over message --- video-games/video-games-test.js | 2 +- video-games/video-games.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/video-games/video-games-test.js b/video-games/video-games-test.js index 338656235..2ca277332 100644 --- a/video-games/video-games-test.js +++ b/video-games/video-games-test.js @@ -100,7 +100,7 @@ describe('video games', function () { assert.equal(updatedLevelPlayerFell.lives, 2); }); - it.skip('should print `GAME OVER` when a player is defeated and has no lives left', function () { + it('should print `GAME OVER` when a player is defeated and has no lives left', function () { var player1 = createPlayer('Ant Cat', 3, ['tiny roar', 'six-legged claws', 'dig tunnel']); var level = createLevel('Alien Outpost', [player1]); diff --git a/video-games/video-games.js b/video-games/video-games.js index fbc6849f4..32f447f46 100644 --- a/video-games/video-games.js +++ b/video-games/video-games.js @@ -25,6 +25,9 @@ function findCoins(level, coinCount) { function defeatPlayer(level) { level.lives -= 1; + if (level.lives == 0) { + return 'GAME OVER' + } return level } From 3ba7026dadebf2c86dee771fc5fad0e8dbfa9eb7 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:26:58 -0600 Subject: [PATCH 60/64] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index efc4f4204..ae25bd4e1 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Completing all of these test suites is not necessary, but you should be working - [x] ✈️ [Airport](./airport) - [x] 🎧 [DJ](./dj) - [x] 🍔 [Favorite Foods](./favorite-foods) -- [ ] 🎮 [Video Games](./video-games/) +- [x] 🎮 [Video Games](./video-games/) - [ ] 🎂 [Birthdays](./birthdays) - [ ] 🗓 [Calendar](./calendar/) - [ ] 💵 [Vending Machine](./dollar-store-vending-machine/) From 51a59e9bf08eb38b2d0e410c672c9e1f50a9a0f4 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:29:35 -0600 Subject: [PATCH 61/64] Create birthday --- birthdays/birthdays-test.js | 2 +- birthdays/birthdays.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/birthdays/birthdays-test.js b/birthdays/birthdays-test.js index a2573d210..6df6d9c24 100644 --- a/birthdays/birthdays-test.js +++ b/birthdays/birthdays-test.js @@ -2,7 +2,7 @@ var assert = require('chai').assert; var { createBirthday, celebrateBirthday, countBirthdays } = require('./birthdays'); describe('Birthdays', function() { - it.skip('should create birthdays', function() { + it('should create birthdays', function() { var leahBirthday = createBirthday('Leah', 2, 10); var christyBirthday = createBirthday('Christy', 3, 8); diff --git a/birthdays/birthdays.js b/birthdays/birthdays.js index 16d2dd549..a1ab00883 100644 --- a/birthdays/birthdays.js +++ b/birthdays/birthdays.js @@ -1,3 +1,11 @@ +function createBirthday(name, month, day) { + return { + name: name, + month: month, + day: day + } +} - -module.exports = { }; \ No newline at end of file +module.exports = { + createBirthday +}; \ No newline at end of file From 9caacb419524e2fedf2e31eeea664d4bdb464a21 Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:31:45 -0600 Subject: [PATCH 62/64] Celebrate birthdays --- birthdays/birthdays-test.js | 2 +- birthdays/birthdays.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/birthdays/birthdays-test.js b/birthdays/birthdays-test.js index 6df6d9c24..1321bc507 100644 --- a/birthdays/birthdays-test.js +++ b/birthdays/birthdays-test.js @@ -15,7 +15,7 @@ describe('Birthdays', function() { assert.deepEqual(christyBirthday.day, 8); }); - it.skip('should celebrate birthdays', function() { + it('should celebrate birthdays', function() { var alexBirthday = createBirthday('Alex', 5, 19); var celebrateAlex = celebrateBirthday(alexBirthday); diff --git a/birthdays/birthdays.js b/birthdays/birthdays.js index a1ab00883..b84e08b68 100644 --- a/birthdays/birthdays.js +++ b/birthdays/birthdays.js @@ -6,6 +6,11 @@ function createBirthday(name, month, day) { } } +function celebrateBirthday(birthday) { + return `Today is ${birthday.month}/${birthday.day}! Happy birthday, ${birthday.name}!` +} + module.exports = { - createBirthday + createBirthday, + celebrateBirthday }; \ No newline at end of file From f0ac569292bace112ed9aa5a9b6542e992404f7b Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:34:54 -0600 Subject: [PATCH 63/64] Count birthdays --- birthdays/birthdays-test.js | 2 +- birthdays/birthdays.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/birthdays/birthdays-test.js b/birthdays/birthdays-test.js index 1321bc507..5b082c279 100644 --- a/birthdays/birthdays-test.js +++ b/birthdays/birthdays-test.js @@ -29,7 +29,7 @@ describe('Birthdays', function() { assert.equal(celebrateHeather, 'Today is 6/29! Happy birthday, Heather!'); }) - it.skip('should count how many birthdays are in a given month', function() { + it('should count how many birthdays are in a given month', function() { var leahBirthday = createBirthday('Leah', 2, 10); var christyBirthday = createBirthday('Christy', 3, 8); var alexBirthday = createBirthday('Alex', 5, 19); diff --git a/birthdays/birthdays.js b/birthdays/birthdays.js index b84e08b68..f1085968f 100644 --- a/birthdays/birthdays.js +++ b/birthdays/birthdays.js @@ -10,7 +10,18 @@ function celebrateBirthday(birthday) { return `Today is ${birthday.month}/${birthday.day}! Happy birthday, ${birthday.name}!` } +function countBirthdays(birthdays, month) { + count = 0; + for (i = 0; i < birthdays.length; i++) { + if (birthdays[i].month == month) { + count += 1; + } + } + return count +} + module.exports = { createBirthday, - celebrateBirthday + celebrateBirthday, + countBirthdays }; \ No newline at end of file From 3cbf48506493c04ce729a5ab5c4e512ed827b95a Mon Sep 17 00:00:00 2001 From: Kaylah Rose Mitchell Date: Mon, 10 Jul 2023 17:35:42 -0600 Subject: [PATCH 64/64] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae25bd4e1..cb1ea463e 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Completing all of these test suites is not necessary, but you should be working - [x] 🎧 [DJ](./dj) - [x] 🍔 [Favorite Foods](./favorite-foods) - [x] 🎮 [Video Games](./video-games/) -- [ ] 🎂 [Birthdays](./birthdays) +- [x] 🎂 [Birthdays](./birthdays) - [ ] 🗓 [Calendar](./calendar/) - [ ] 💵 [Vending Machine](./dollar-store-vending-machine/) - [ ] 🛗 [Elevator](./elevator/)