From 59bb244286dd514748ba22b6277969e709fdc0c0 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 23 Aug 2015 13:10:30 -0700 Subject: [PATCH 1/9] start refactoring bonfire tests --- seed/challenges/basic-bonfires.json | 172 ++++++++++++++-------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 539ce1d349..6ec7aa958b 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -13,8 +13,8 @@ "Make this function return true no matter what." ], "tests": [ - "expect(meetBonfire()).to.be.a(\"boolean\");", - "expect(meetBonfire()).to.be.true;" + "assert(typeof(meetBonfire()) === \"boolean\", 'The result should be a Boolean value of true or false.');", + "assert(meetBonfire() === true, 'Your meetBonfire() function should return true.');" ], "challengeSeed": [ "function meetBonfire(argument) {", @@ -46,10 +46,10 @@ "title": "Reverse a String", "difficulty": "1.01", "tests": [ - "expect(reverseString('hello')).to.be.a('String');", - "expect(reverseString('hello')).to.equal('olleh');", - "expect(reverseString('Howdy')).to.equal('ydwoH');", - "expect(reverseString('Greetings from Earth')).to.equal('htraE morf sgniteerG');" + "assert(typeof(reverseString('hello')) === \"string\", 'reverseString() should return a string.');", + "assert(reverseString('hello') === 'olleh', '\"hello\" should become \"olleh\".');", + "assert(reverseString('Howdy') === 'ydwoH', '\"Howdy\" should become \"ydwoH\".');", + "assert(reverseString('Greetings from Earth') === 'htraE morf sgniteerG', '\"Greetings from Earth\" should return \"htraE morf sgniteerG\".');" ], "description": [ "Reverse the provided string.", @@ -62,7 +62,7 @@ " return str;", "}", "", - "reverseString('hello');" + "reverseString('hello', '');" ], "MDNlinks": [ "Global String Object", @@ -87,10 +87,10 @@ "id": "a302f7aae1aa3152a5b413bc", "title": "Factorialize a Number", "tests": [ - "expect(factorialize(5)).to.be.a(\"Number\");", - "expect(factorialize(5)).to.equal(120);", - "expect(factorialize(10)).to.equal(3628800);", - "expect(factorialize(20)).to.equal(2432902008176640000);" + "assert(typeof(factorialize(5)) === \"number\", 'factorialize() should return a number.');", + "assert(factorialize(5) === 120, '5 should return 120.');", + "assert(factorialize(10) === 3628800, '10 should return 3,628,800.');", + "assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');" ], "difficulty": "1.02", "description": [ @@ -105,7 +105,7 @@ " return num;", "}", "", - "factorialize(5);" + "factorialize(5, '');" ], "MDNlinks": [ "Arithmetic Operators" @@ -135,14 +135,14 @@ "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "tests": [ - "expect(palindrome(\"eye\")).to.be.a(\"boolean\");", - "assert.deepEqual(palindrome(\"eye\"), true);", - "assert.deepEqual(palindrome(\"race car\"), true);", - "assert.deepEqual(palindrome(\"not a palindrome\"), false);", - "assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true);", - "assert.deepEqual(palindrome(\"never odd or even\"), true);", - "assert.deepEqual(palindrome(\"nope\"), false);", - "assert.deepEqual(palindrome(\"almostomla\"), false);" + "assert(palindrome(\"eye\")) === \"boolean\", '');", + "assert.deepEqual(palindrome(\"eye\"), true, '');", + "assert.deepEqual(palindrome(\"race car\"), true, '');", + "assert.deepEqual(palindrome(\"not a palindrome\"), false, '');", + "assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true, '');", + "assert.deepEqual(palindrome(\"never odd or even\"), true, '');", + "assert.deepEqual(palindrome(\"nope\"), false, '');", + "assert.deepEqual(palindrome(\"almostomla\"), false, '');" ], "challengeSeed": [ "function palindrome(str) {", @@ -152,7 +152,7 @@ "", "", "", - "palindrome(\"eye\");" + "palindrome(\"eye\", '');" ], "MDNlinks": [ "String.replace()", @@ -185,15 +185,15 @@ " return str.length;", "}", "", - "findLongestWord('The quick brown fox jumped over the lazy dog');" + "findLongestWord('The quick brown fox jumped over the lazy dog', '');" ], "tests": [ - "expect(findLongestWord('The quick brown fox jumped over the lazy dog')).to.be.a('Number');", - "expect(findLongestWord('The quick brown fox jumped over the lazy dog')).to.equal(6);", - "expect(findLongestWord('May the force be with you')).to.equal(5);", - "expect(findLongestWord('Google do a barrel roll')).to.equal(6);", - "expect(findLongestWord('What is the average airspeed velocity of an unladen swallow')).to.equal(8);", - "expect(findLongestWord('What if we try a super-long word such as otorhinolaryngology')).to.equal(19);" + "assert(findLongestWord('The quick brown fox jumped over the lazy dog')) === 'Number', '');", + "assert(findLongestWord('The quick brown fox jumped over the lazy dog') === 6, '');", + "assert(findLongestWord('May the force be with you') === 5, '');", + "assert(findLongestWord('Google do a barrel roll') === 6, '');", + "assert(findLongestWord('What is the average airspeed velocity of an unladen swallow') === 8, '');", + "assert(findLongestWord('What if we try a super-long word such as otorhinolaryngology') === 19, '');" ], "MDNlinks": [ "String.split()", @@ -226,13 +226,13 @@ " return str;", "}", "", - "titleCase(\"I'm a little tea pot\");" + "titleCase(\"I'm a little tea pot\", '');" ], "tests": [ - "expect(titleCase(\"I'm a little tea pot\")).to.be.a('String');", - "expect(titleCase(\"I'm a little tea pot\")).to.equal(\"I'm A Little Tea Pot\");", - "expect(titleCase(\"sHoRt AnD sToUt\")).to.equal(\"Short And Stout\");", - "expect(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\")).to.equal(\"Here Is My Handle Here Is My Spout\");" + "assert(titleCase(\"I'm a little tea pot\")) === 'String', '');", + "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '');", + "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '');", + "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '');" ], "MDNlinks": [ "String.charAt()" @@ -266,12 +266,12 @@ " return arr;", "}", "", - "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);" + "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]], '');" ], "tests": [ - "expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');", - "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,39,1001]);", - "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));" + "assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === 'array', '');", + "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,39,1001], '');", + "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]), '');" ], "MDNlinks": [ "Comparison Operators" @@ -304,14 +304,14 @@ " return str;", "}", "", - "end('Bastian', 'n');" + "end('Bastian', 'n', '');" ], "tests": [ - "assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string');", - "assert.strictEqual(end('Connor', 'n'), false, 'should equal false if target does not equal end of string');", - "assert.strictEqual(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification'), false, 'should equal false if target does not equal end of string');", - "assert.strictEqual(end('He has to give me a new name', 'name'), true, 'should equal true if target equals end of string');", - "assert.strictEqual(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain'), false, 'should equal false if target does not equal end of string');" + "assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string', '');", + "assert.strictEqual(end('Connor', 'n'), false, 'should equal false if target does not equal end of string', '');", + "assert.strictEqual(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification'), false, 'should equal false if target does not equal end of string', '');", + "assert.strictEqual(end('He has to give me a new name', 'name'), true, 'should equal true if target equals end of string', '');", + "assert.strictEqual(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain'), false, 'should equal false if target does not equal end of string', '');" ], "MDNlinks": [ "String.substr()" @@ -343,12 +343,12 @@ " return str;", "}", "", - "repeat('abc', 3);" + "repeat('abc', 3, '');" ], "tests": [ - "assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times');", - "assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times');", - "assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers');" + "assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times', '');", + "assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times', '');", + "assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers', '');" ], "MDNlinks": [ "Global String Object" @@ -381,13 +381,13 @@ " return str;", "}", "", - "truncate('A-tisket a-tasket A green and yellow basket', 11);" + "truncate('A-tisket a-tasket A green and yellow basket', 11, '');" ], "tests": [ - "expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');", - "expect(truncate('Peter Piper picked a peck of pickled peppers', 14)).to.eqls('Peter Piper...');", - "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length');", - "assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length');" + "assert(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...', '');", + "assert(truncate('Peter Piper picked a peck of pickled peppers', 14)).to.eqls('Peter Piper...', '');", + "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length', '');", + "assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length', '');" ], "MDNlinks": [ "String.slice()" @@ -419,13 +419,13 @@ " return arr;", "}", "", - "chunk(['a', 'b', 'c', 'd'], 2);" + "chunk(['a', 'b', 'c', 'd'], 2, '');" ], "tests": [ - "assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');", - "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');", - "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], 'should return chunked arrays');", - "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements');" + "assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays', '');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays', '');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], 'should return chunked arrays', '');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements', '');" ], "MDNlinks": [ "Array.push()" @@ -457,12 +457,12 @@ " return arr;", "}", "", - "slasher([1, 2, 3], 2);" + "slasher([1, 2, 3], 2, '');" ], "tests": [ - "assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements');", - "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements');", - "assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array');" + "assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements', '');", + "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements', '');", + "assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array', '');" ], "MDNlinks": [ "Array.slice()", @@ -497,17 +497,17 @@ " return arr;", "}", "", - "mutation(['hello', 'hey']);" + "mutation(['hello', 'hey'], '');" ], "tests": [ - "expect(mutation(['hello', 'hey'])).to.be.false;", - "expect(mutation(['hello', 'Hello'])).to.be.true;", - "expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;", - "expect(mutation(['Mary', 'Army'])).to.be.true;", - "expect(mutation(['Mary', 'Aarmy'])).to.be.true;", - "expect(mutation(['Alien', 'line'])).to.be.true;", - "expect(mutation(['floor', 'for'])).to.be.true;", - "expect(mutation(['hello', 'neo'])).to.be.false;" + "assert(mutation(['hello', 'hey'])).to.be.false;", + "assert(mutation(['hello', 'Hello'])).to.be.true;", + "assert(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;", + "assert(mutation(['Mary', 'Army'])).to.be.true;", + "assert(mutation(['Mary', 'Aarmy'])).to.be.true;", + "assert(mutation(['Alien', 'line'])).to.be.true;", + "assert(mutation(['floor', 'for'])).to.be.true;", + "assert(mutation(['hello', 'neo'])).to.be.false;" ], "MDNlinks": [ "Array.indexOf()" @@ -540,12 +540,12 @@ " return arr;", "}", "", - "bouncer([7, 'ate', '', false, 9]);" + "bouncer([7, 'ate', '', false, 9], '');" ], "tests": [ - "assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values');", - "assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements');", - "assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey');" + "assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values', '');", + "assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements', '');", + "assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey', '');" ], "MDNlinks": [ "Boolean Objects", @@ -579,11 +579,11 @@ " return arr;", "}", "", - "where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });" + "where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }, '');" ], "tests": [ - "assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects');", - "assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples');" + "assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects', '');", + "assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples', '');" ], "MDNlinks": [ "Global Object", @@ -617,14 +617,14 @@ " return arr;", "}", "", - "destroyer([1, 2, 3, 1, 2, 3], 2, 3);" + "destroyer([1, 2, 3, 1, 2, 3], 2, 3, '');" ], "tests": [ - "assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array');", - "assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array');", - "assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], 'should accept more than two additional arguments');", - "assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], 'should remove correct values from an array');", - "assert.deepEqual(destroyer(['tree', 'hamburger', 53], 'tree', 53), ['hamburger'], 'should handle NaN-elements');" + "assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array', '');", + "assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array', '');", + "assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], 'should accept more than two additional arguments', '');", + "assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], 'should remove correct values from an array', '');", + "assert.deepEqual(destroyer(['tree', 'hamburger', 53], 'tree', 53), ['hamburger'], 'should handle NaN-elements', '');" ], "MDNlinks": [ "Arguments object", @@ -658,14 +658,14 @@ " return num;", "}", "", - "where([40, 60], 50);" + "where([40, 60], 50, '');" ], "MDNlinks": [ "Array.sort()" ], "tests": [ - "expect(where([10, 20, 30, 40, 50], 35)).to.equal(3);", - "expect(where([10, 20, 30, 40, 50], 30)).to.equal(2);" + "assert(where([10, 20, 30, 40, 50], 35) === 3, '');", + "assert(where([10, 20, 30, 40, 50], 30) === 2, '');" ], "type": "bonfire", "challengeType": 5, From e4896eb0c0c95dd4fd7e4299c40ab490a6e32c24 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 23 Aug 2015 15:18:40 -0700 Subject: [PATCH 2/9] continue refactor of tests --- seed/challenges/basic-bonfires.json | 64 ++++++++++++++--------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 6ec7aa958b..0cc2ff53c4 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -14,7 +14,7 @@ ], "tests": [ "assert(typeof(meetBonfire()) === \"boolean\", 'The result should be a Boolean value of true or false.');", - "assert(meetBonfire() === true, 'Your meetBonfire() function should return true.');" + "assert(meetBonfire() === true, 'Your meetBonfire() function should return true.');" ], "challengeSeed": [ "function meetBonfire(argument) {", @@ -87,17 +87,17 @@ "id": "a302f7aae1aa3152a5b413bc", "title": "Factorialize a Number", "tests": [ - "assert(typeof(factorialize(5)) === \"number\", 'factorialize() should return a number.');", - "assert(factorialize(5) === 120, '5 should return 120.');", - "assert(factorialize(10) === 3628800, '10 should return 3,628,800.');", - "assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');" + "assert(typeof(factorialize(5)) === \"number\", 'factorialize() should return a number.');", + "assert(factorialize(5) === 120, '5 should return 120.');", + "assert(factorialize(10) === 3628800, '10 should return 3,628,800.');", + "assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');" ], "difficulty": "1.02", "description": [ "Return the factorial of the provided integer.", "If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.", - "Factorials are often represented with the shorthand notation n!", - "For example: 5! = 1 * 2 * 3 * 4 * 5 = 120f", + "Factorials are often represented with the shorthand notation n!", + "For example: 5! = 1 * 2 * 3 * 4 * 5 = 120", "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ @@ -135,14 +135,14 @@ "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "tests": [ - "assert(palindrome(\"eye\")) === \"boolean\", '');", - "assert.deepEqual(palindrome(\"eye\"), true, '');", - "assert.deepEqual(palindrome(\"race car\"), true, '');", - "assert.deepEqual(palindrome(\"not a palindrome\"), false, '');", - "assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true, '');", - "assert.deepEqual(palindrome(\"never odd or even\"), true, '');", - "assert.deepEqual(palindrome(\"nope\"), false, '');", - "assert.deepEqual(palindrome(\"almostomla\"), false, '');" + "assert(typeof(palindrome(\"eye\")) === \"boolean\", 'palindrome() should return a boolean.');", + "assert(palindrome(\"eye\") === true, '\"eye\" should return true.');", + "assert(palindrome(\"race car\") === true, '\"race car\" should return true.');", + "assert(palindrome(\"not a palindrome\") === false, '\"not a palindrome\" should return false.');", + "assert(palindrome(\"A man, a plan, a canal. Panama\") === true, '\"A man, a plan, a canal. Panama\" should return true.');", + "assert(palindrome(\"never odd or even\") === true, '\"never odd or even\" should return true.');", + "assert(palindrome(\"nope\") === false, '\"nope\" should return false.');", + "assert(palindrome(\"almostomla\") === false, '\"almostomla\" should return false.');" ], "challengeSeed": [ "function palindrome(str) {", @@ -152,7 +152,7 @@ "", "", "", - "palindrome(\"eye\", '');" + "palindrome(\"eye\");" ], "MDNlinks": [ "String.replace()", @@ -185,15 +185,15 @@ " return str.length;", "}", "", - "findLongestWord('The quick brown fox jumped over the lazy dog', '');" + "findLongestWord('The quick brown fox jumped over the lazy dog');" ], "tests": [ - "assert(findLongestWord('The quick brown fox jumped over the lazy dog')) === 'Number', '');", - "assert(findLongestWord('The quick brown fox jumped over the lazy dog') === 6, '');", - "assert(findLongestWord('May the force be with you') === 5, '');", - "assert(findLongestWord('Google do a barrel roll') === 6, '');", - "assert(findLongestWord('What is the average airspeed velocity of an unladen swallow') === 8, '');", - "assert(findLongestWord('What if we try a super-long word such as otorhinolaryngology') === 19, '');" + "assert(typeOf(findLongestWord(\"The quick brown fox jumped over the lazy dog\")) === 'number', 'findLongestWord() should return a number.');", + "assert(findLongestWord(\"The quick brown fox jumped over the lazy dog\") === 6, '\"The quick brown fox jumped over the lazy dog\" should return 6.');", + "assert(findLongestWord(\"May the force be with you\") === 5, '\"May the force be with you\" should return 5.');", + "assert(findLongestWord(\"Google do a barrel roll\") === 6, '\"Google do a barrel roll\" should return 6.');", + "assert(findLongestWord(\"What is the average airspeed velocity of an unladen swallow\") === 8, '\"What is the average airspeed velocity of an unladen swallow\" should return 8.');", + "assert(findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\") === 19, '\"What if we try a super-long word such as otorhinolaryngology\" should return 18.');" ], "MDNlinks": [ "String.split()", @@ -229,7 +229,7 @@ "titleCase(\"I'm a little tea pot\", '');" ], "tests": [ - "assert(titleCase(\"I'm a little tea pot\")) === 'String', '');", + "assert(typeOf(titleCase(\"I'm a little tea pot\")) === 'String', 'titleCase() should return a string.');", "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '');", "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '');", "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '');" @@ -269,7 +269,7 @@ "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]], '');" ], "tests": [ - "assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === 'array', '');", + "assert(typeOf(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === 'array', 'largestOfFour() should return an array.');", "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,39,1001], '');", "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]), '');" ], @@ -422,10 +422,10 @@ "chunk(['a', 'b', 'c', 'd'], 2, '');" ], "tests": [ - "assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays', '');", - "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays', '');", - "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], 'should return chunked arrays', '');", - "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements', '');" + "assert(chunk(['a', 'b', 'c', 'd'], 2) === [['a', 'b'], ['c', 'd']], 'chunk(['a', 'b', 'c', 'd'], 2) should return [['a', 'b'], ['c', 'd']].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 3) === [[0, 1, 2], [3, 4, 5]], 'chunk([0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 2) === [[0, 1], [2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 2) should return [[0, 1], [2, 3], [4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 4) === [[0, 1, 2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].');" ], "MDNlinks": [ "Array.push()" @@ -460,9 +460,9 @@ "slasher([1, 2, 3], 2, '');" ], "tests": [ - "assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements', '');", - "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements', '');", - "assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array', '');" + "assert(slasher([1, 2, 3], 2) === [3]), 'slasher([1, 2, 3], 2), [3] should return [3].');", + "assert(slasher([1, 2, 3], 0) === [1, 2, 3]), 'slasher([1, 2, 3], 0) should return [1, 2, 3].');", + "assert(slasher([1, 2, 3], 9) === []), 'slasher([1, 2, 3], 9) should return [].');" ], "MDNlinks": [ "Array.slice()", From c264ce6e9df616f9855e803c8d24504d7e9ef095 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 23 Aug 2015 18:02:58 -0700 Subject: [PATCH 3/9] continue refactoring bonfire tests --- seed/challenges/basic-bonfires.json | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 0cc2ff53c4..fe3ecac9d5 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -230,9 +230,9 @@ ], "tests": [ "assert(typeOf(titleCase(\"I'm a little tea pot\")) === 'String', 'titleCase() should return a string.');", - "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '');", - "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '');", - "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '');" + "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '\"I'm a little tea pot\" should return \"I'm A Little Tea Pot\"');", + "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '\"sHoRt AnD sToUt\" should return \"Short And Stout\"');", + "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '\"HERE IS MY HANDLE HERE IS MY SPOUT\" should return \"Here Is My Handle Here Is My Spout\"');" ], "MDNlinks": [ "String.charAt()" @@ -270,8 +270,8 @@ ], "tests": [ "assert(typeOf(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === 'array', 'largestOfFour() should return an array.');", - "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,39,1001], '');", - "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]), '');" + "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]) === [27,5,39,1001], '[[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]] should return [27,5,39,1001].');", + "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) === [9,35,97,1000000], '[[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]] should return [9,35,97,1000000].');" ], "MDNlinks": [ "Comparison Operators" @@ -307,11 +307,11 @@ "end('Bastian', 'n', '');" ], "tests": [ - "assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string', '');", - "assert.strictEqual(end('Connor', 'n'), false, 'should equal false if target does not equal end of string', '');", - "assert.strictEqual(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification'), false, 'should equal false if target does not equal end of string', '');", - "assert.strictEqual(end('He has to give me a new name', 'name'), true, 'should equal true if target equals end of string', '');", - "assert.strictEqual(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain'), false, 'should equal false if target does not equal end of string', '');" + "assert(end('Bastian', 'n') === true, 'end(\"Bastian\", \"n\") should return true.');", + "assert(end('Connor', 'n') === false, 'end(\"Connor\", \"n\") should return false.');", + "assert(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification') === false, 'end(Walking on water and developing software from a specification are easy if both are frozen.', 'specification') should return false.');", + "assert(end('He has to give me a new name', 'name') === true, 'end(\"He has to give me a new name\", \"name\") should return true.');", + "assert(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain') === false, 'end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain') should return false.');" ], "MDNlinks": [ "String.substr()" @@ -346,9 +346,9 @@ "repeat('abc', 3, '');" ], "tests": [ - "assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times', '');", - "assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times', '');", - "assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers', '');" + "assert(repeat('*', 3) === '***', 'repeat(\"*\", 3) should return \"***\");", + "assert(repeat('abc', 3) === 'abcabcabc', 'repeat(\"abc\", 3) should return \"abcabcabc\".');", + "assert(repeat('abc', -2) === '', 'repeat(\"abc\", -2) should return \"\".');" ], "MDNlinks": [ "Global String Object" @@ -384,10 +384,10 @@ "truncate('A-tisket a-tasket A green and yellow basket', 11, '');" ], "tests": [ - "assert(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...', '');", - "assert(truncate('Peter Piper picked a peck of pickled peppers', 14)).to.eqls('Peter Piper...', '');", - "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length', '');", - "assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length', '');" + "assert(truncate('A-tisket a-tasket A green and yellow basket', 11) === 'A-tisket...', 'truncate(\"A-tisket a-tasket A green and yellow basket\", 11) should return \"A-tisket...\".');", + "assert(truncate('Peter Piper picked a peck of pickled peppers', 14) === 'Peter Piper...', 'truncate(\"Peter Piper picked a peck of pickled peppers\", 14) should return \"Peter Piper...\".);", + "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'truncate(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length) should return \"A-tisket a-tasket A green and yellow basket\".');", + "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2 === 'A-tisket a-tasket A green and yellow basket', 'truncate(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length + 2) should return \"A-tisket a-tasket A green and yellow basket\".);" ], "MDNlinks": [ "String.slice()" @@ -422,10 +422,10 @@ "chunk(['a', 'b', 'c', 'd'], 2, '');" ], "tests": [ - "assert(chunk(['a', 'b', 'c', 'd'], 2) === [['a', 'b'], ['c', 'd']], 'chunk(['a', 'b', 'c', 'd'], 2) should return [['a', 'b'], ['c', 'd']].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 3) === [[0, 1, 2], [3, 4, 5]], 'chunk([0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 2) === [[0, 1], [2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 2) should return [[0, 1], [2, 3], [4, 5]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 4) === [[0, 1, 2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].');" + "assert(chunk(['a', 'b', 'c', 'd'], 2) === [['a', 'b'], ['c', 'd']], 'chunk([\"a\", \"b\", \"c\", \"d\"], 2) should return [[\"a\", \"b\"], [\"c\", \"d\"]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 3) === [[0, 1, 2], [3, 4, 5]], 'chunk([0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 2) === [[0, 1], [2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 2) should return [[0, 1], [2, 3], [4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 4) === [[0, 1, 2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].');" ], "MDNlinks": [ "Array.push()" @@ -460,9 +460,9 @@ "slasher([1, 2, 3], 2, '');" ], "tests": [ - "assert(slasher([1, 2, 3], 2) === [3]), 'slasher([1, 2, 3], 2), [3] should return [3].');", - "assert(slasher([1, 2, 3], 0) === [1, 2, 3]), 'slasher([1, 2, 3], 0) should return [1, 2, 3].');", - "assert(slasher([1, 2, 3], 9) === []), 'slasher([1, 2, 3], 9) should return [].');" + "assert(slasher([1, 2, 3], 2) === [3]), 'slasher([1, 2, 3], 2), [3] should return [3].');", + "assert(slasher([1, 2, 3], 0) === [1, 2, 3]), 'slasher([1, 2, 3], 0) should return [1, 2, 3].');", + "assert(slasher([1, 2, 3], 9) === []), 'slasher([1, 2, 3], 9) should return [].');" ], "MDNlinks": [ "Array.slice()", From 28073a61d722badea596813baf5f2fc783199752 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Wed, 26 Aug 2015 23:23:46 -0700 Subject: [PATCH 4/9] continue refactoring bonfire tests --- seed/challenges/basic-bonfires.json | 202 ++++++++++++++-------------- 1 file changed, 101 insertions(+), 101 deletions(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index fe3ecac9d5..60d3edd03e 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -46,23 +46,23 @@ "title": "Reverse a String", "difficulty": "1.01", "tests": [ - "assert(typeof(reverseString('hello')) === \"string\", 'reverseString() should return a string.');", - "assert(reverseString('hello') === 'olleh', '\"hello\" should become \"olleh\".');", - "assert(reverseString('Howdy') === 'ydwoH', '\"Howdy\" should become \"ydwoH\".');", - "assert(reverseString('Greetings from Earth') === 'htraE morf sgniteerG', '\"Greetings from Earth\" should return \"htraE morf sgniteerG\".');" + "assert(typeof(reverseString(\"hello\")) === \"string\", 'reverseString() should return a string.');", + "assert(reverseString(\"hello\") === \"olleh\", '\"hello\" should become \"olleh\".');", + "assert(reverseString(\"Howdy\") === \"ydwoH\", '\"Howdy\" should become \"ydwoH\".');", + "assert(reverseString(\"Greetings from Earth\") === \"htraE morf sgniteerG\", '\"Greetings from Earth\" should return \"htraE morf sgniteerG\".');" ], "description": [ "Reverse the provided string.", "You may need to turn the string into an array before you can reverse it.", "Your result must be a string.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function reverseString(str) {", " return str;", "}", "", - "reverseString('hello', '');" + "reverseString(\"hello\", \"\");" ], "MDNlinks": [ "Global String Object", @@ -88,9 +88,9 @@ "title": "Factorialize a Number", "tests": [ "assert(typeof(factorialize(5)) === \"number\", 'factorialize() should return a number.');", - "assert(factorialize(5) === 120, '5 should return 120.');", - "assert(factorialize(10) === 3628800, '10 should return 3,628,800.');", - "assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');" + "assert(factorialize(5) === 120, '5 should return 120.');", + "assert(factorialize(10) === 3628800, '10 should return 3,628,800.');", + "assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');" ], "difficulty": "1.02", "description": [ @@ -98,7 +98,7 @@ "If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.", "Factorials are often represented with the shorthand notation n!", "For example: 5! = 1 * 2 * 3 * 4 * 5 = 120", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function factorialize(num) {", @@ -132,17 +132,17 @@ "A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.", "You'll need to remove punctuation and turn everything lower case in order to check for palindromes.", "We'll pass strings with varying formats, such as \"racecar\", \"RaceCar\", and \"race CAR\" among others.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "tests": [ "assert(typeof(palindrome(\"eye\")) === \"boolean\", 'palindrome() should return a boolean.');", - "assert(palindrome(\"eye\") === true, '\"eye\" should return true.');", - "assert(palindrome(\"race car\") === true, '\"race car\" should return true.');", - "assert(palindrome(\"not a palindrome\") === false, '\"not a palindrome\" should return false.');", - "assert(palindrome(\"A man, a plan, a canal. Panama\") === true, '\"A man, a plan, a canal. Panama\" should return true.');", - "assert(palindrome(\"never odd or even\") === true, '\"never odd or even\" should return true.');", - "assert(palindrome(\"nope\") === false, '\"nope\" should return false.');", - "assert(palindrome(\"almostomla\") === false, '\"almostomla\" should return false.');" + "assert(palindrome(\"eye\") === true, '\"eye\" should return true.');", + "assert(palindrome(\"race car\") === true, '\"race car\" should return true.');", + "assert(palindrome(\"not a palindrome\") === false, '\"not a palindrome\" should return false.');", + "assert(palindrome(\"A man, a plan, a canal. Panama\") === true, '\"A man, a plan, a canal. Panama\" should return true.');", + "assert(palindrome(\"never odd or even\") === true, '\"never odd or even\" should return true.');", + "assert(palindrome(\"nope\") === false, '\"nope\" should return false.');", + "assert(palindrome(\"almostomla\") === false, '\"almostomla\" should return false.');" ], "challengeSeed": [ "function palindrome(str) {", @@ -178,22 +178,22 @@ "description": [ "Return the length of the longest word in the provided sentence.", "Your response should be a number.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function findLongestWord(str) {", " return str.length;", "}", "", - "findLongestWord('The quick brown fox jumped over the lazy dog');" + "findLongestWord(\"The quick brown fox jumped over the lazy dog\");" ], "tests": [ - "assert(typeOf(findLongestWord(\"The quick brown fox jumped over the lazy dog\")) === 'number', 'findLongestWord() should return a number.');", - "assert(findLongestWord(\"The quick brown fox jumped over the lazy dog\") === 6, '\"The quick brown fox jumped over the lazy dog\" should return 6.');", - "assert(findLongestWord(\"May the force be with you\") === 5, '\"May the force be with you\" should return 5.');", - "assert(findLongestWord(\"Google do a barrel roll\") === 6, '\"Google do a barrel roll\" should return 6.');", - "assert(findLongestWord(\"What is the average airspeed velocity of an unladen swallow\") === 8, '\"What is the average airspeed velocity of an unladen swallow\" should return 8.');", - "assert(findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\") === 19, '\"What if we try a super-long word such as otorhinolaryngology\" should return 18.');" + "assert(typeOf(findLongestWord(\"The quick brown fox jumped over the lazy dog\")) === \"number\", 'findLongestWord() should return a number.');", + "assert(findLongestWord(\"The quick brown fox jumped over the lazy dog\") === 6, '\"The quick brown fox jumped over the lazy dog\" should return 6.');", + "assert(findLongestWord(\"May the force be with you\") === 5, '\"May the force be with you\" should return 5.');", + "assert(findLongestWord(\"Google do a barrel roll\") === 6, '\"Google do a barrel roll\" should return 6.');", + "assert(findLongestWord(\"What is the average airspeed velocity of an unladen swallow\") === 8, '\"What is the average airspeed velocity of an unladen swallow\" should return 8.');", + "assert(findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\") === 19, '\"What if we try a super-long word such as otorhinolaryngology\" should return 18.');" ], "MDNlinks": [ "String.split()", @@ -218,21 +218,21 @@ "difficulty": "1.05", "description": [ "Return the provided string with the first letter of each word capitalized.", - "For the purpose of this exercise, you should also capitalize connecting words like 'the' and 'of'.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "For the purpose of this exercise, you should also capitalize connecting words like \"the\" and \"of\".", + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function titleCase(str) {", " return str;", "}", "", - "titleCase(\"I'm a little tea pot\", '');" + "titleCase(\"I'm a little tea pot\", \"\");" ], "tests": [ - "assert(typeOf(titleCase(\"I'm a little tea pot\")) === 'String', 'titleCase() should return a string.');", - "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '\"I'm a little tea pot\" should return \"I'm A Little Tea Pot\"');", - "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '\"sHoRt AnD sToUt\" should return \"Short And Stout\"');", - "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '\"HERE IS MY HANDLE HERE IS MY SPOUT\" should return \"Here Is My Handle Here Is My Spout\"');" + "assert(typeOf(titleCase(\"I'm a little tea pot\")) === \"String\", 'titleCase() should return a string.');", + "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '\"I'm a little tea pot\" should return \"I'm A Little Tea Pot\".');", + "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '\"sHoRt AnD sToUt\" should return \"Short And Stout\".');", + "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '\"HERE IS MY HANDLE HERE IS MY SPOUT\" should return \"Here Is My Handle Here Is My Spout\"');" ], "MDNlinks": [ "String.charAt()" @@ -258,7 +258,7 @@ "Return an array consisting of the largest number from each provided sub-array. For simplicity, the provided array will contain exactly 4 sub-arrays.", "Remember, you can iterate through an array with a simple for loop, and access each member with array syntax arr[i] .", "If you are writing your own Chai.js tests, be sure to use a deep equal statement instead of an equal statement when comparing arrays.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function largestOfFour(arr) {", @@ -266,12 +266,12 @@ " return arr;", "}", "", - "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]], '');" + "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]], \"\");" ], "tests": [ - "assert(typeOf(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === 'array', 'largestOfFour() should return an array.');", - "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]) === [27,5,39,1001], '[[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]] should return [27,5,39,1001].');", - "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) === [9,35,97,1000000], '[[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]] should return [9,35,97,1000000].');" + "assert(typeOf(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === \"array\", 'largestOfFour() should return an array.');", + "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]) === [27,5,39,1001], '[[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]] should return [27&344;5&344;39&344;1001].');", + "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) === [9,35,97,1000000], '[[4&344; 9&344; 1&344; 3]&344; [13&344; 35&344; 18&344; 26]&344; [32&344; 35&344; 97&344; 39]&344; [1000000&344; 1001&344; 857&344; 1]] should return [9&344;35&344;97&344;1000000].');" ], "MDNlinks": [ "Comparison Operators" @@ -295,7 +295,7 @@ "difficulty": "1.07", "description": [ "Check if a string (first argument) ends with the given target string (second argument).", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function end(str, target) {", @@ -304,14 +304,14 @@ " return str;", "}", "", - "end('Bastian', 'n', '');" + "end(\"Bastian\", \"n\", \"\");" ], "tests": [ - "assert(end('Bastian', 'n') === true, 'end(\"Bastian\", \"n\") should return true.');", - "assert(end('Connor', 'n') === false, 'end(\"Connor\", \"n\") should return false.');", - "assert(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification') === false, 'end(Walking on water and developing software from a specification are easy if both are frozen.', 'specification') should return false.');", - "assert(end('He has to give me a new name', 'name') === true, 'end(\"He has to give me a new name\", \"name\") should return true.');", - "assert(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain') === false, 'end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain') should return false.');" + "assert(end(\"Bastian\", \"n\") === true, 'end(\"Bastian\", \"n\") should return true.');", + "assert(end(\"Connor\", \"n\") === false, 'end(\"Connor\", \"n\") should return false.');", + "assert(end(\"Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\") === false, 'Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\") should return false.');", + "assert(end(\"He has to give me a new name\", \"name\") === true, '\"He has to give me a new name\", \"name\" should return true.');", + "assert(end(\"If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing\", \"mountain\") === false, '\"If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing\", \"mountain\" should return false.');" ], "MDNlinks": [ "String.substr()" @@ -335,7 +335,7 @@ "difficulty": "1.08", "description": [ "Repeat a given string (first argument) n times (second argument). Return an empty string if n is a negative number.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function repeat(str, num) {", @@ -343,12 +343,12 @@ " return str;", "}", "", - "repeat('abc', 3, '');" + "repeat(\"abc\", 3, \"\");" ], "tests": [ - "assert(repeat('*', 3) === '***', 'repeat(\"*\", 3) should return \"***\");", - "assert(repeat('abc', 3) === 'abcabcabc', 'repeat(\"abc\", 3) should return \"abcabcabc\".');", - "assert(repeat('abc', -2) === '', 'repeat(\"abc\", -2) should return \"\".');" + "assert(repeat(\"*\", 3) === \"***\", '\"*\", 3 should return \"***\".);", + "assert(repeat(\"abc\", 3) === \"abcabcabc\", '\"abc\", 3 should return \"abcabcabc\".');", + "assert(repeat(\"abc\", -2) === \"\", '\"abc\", -2 should return \"\".');" ], "MDNlinks": [ "Global String Object" @@ -371,9 +371,9 @@ "title": "Truncate a string", "difficulty": "1.09", "description": [ - "Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a '...' ending.", + "Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a \"...\" ending.", "Note that the three dots at the end add to the string length.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function truncate(str, num) {", @@ -381,13 +381,13 @@ " return str;", "}", "", - "truncate('A-tisket a-tasket A green and yellow basket', 11, '');" + "truncate(\"A-tisket a-tasket A green and yellow basket\", 11, \"\");" ], "tests": [ - "assert(truncate('A-tisket a-tasket A green and yellow basket', 11) === 'A-tisket...', 'truncate(\"A-tisket a-tasket A green and yellow basket\", 11) should return \"A-tisket...\".');", - "assert(truncate('Peter Piper picked a peck of pickled peppers', 14) === 'Peter Piper...', 'truncate(\"Peter Piper picked a peck of pickled peppers\", 14) should return \"Peter Piper...\".);", - "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'truncate(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length) should return \"A-tisket a-tasket A green and yellow basket\".');", - "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2 === 'A-tisket a-tasket A green and yellow basket', 'truncate(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length + 2) should return \"A-tisket a-tasket A green and yellow basket\".);" + "assert(truncate(\"A-tisket a-tasket A green and yellow basket\", 11) === \"A-tisket...\", '\"A-tisket a-tasket A green and yellow basket\", 1 should return \"A-tisket...\".');", + "assert(truncate(\"Peter Piper picked a peck of pickled peppers\", 14) === \"Peter Piper...\", '\"Peter Piper picked a peck of pickled peppers\", 14 should return \"Peter Piper...\".);", + "assert(truncate(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length) === \"A-tisket a-tasket A green and yellow basket\", '\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length) should return \"A-tisket a-tasket A green and yellow basket\".');", + "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2 === 'A-tisket a-tasket A green and yellow basket', '\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length + 2 should return \"A-tisket a-tasket A green and yellow basket\".);" ], "MDNlinks": [ "String.slice()" @@ -411,7 +411,7 @@ "difficulty": "1.10", "description": [ "Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function chunk(arr, size) {", @@ -419,13 +419,13 @@ " return arr;", "}", "", - "chunk(['a', 'b', 'c', 'd'], 2, '');" + "chunk([\"a\", \"b\", \"c\", \"d\"], 2, \"\");" ], "tests": [ - "assert(chunk(['a', 'b', 'c', 'd'], 2) === [['a', 'b'], ['c', 'd']], 'chunk([\"a\", \"b\", \"c\", \"d\"], 2) should return [[\"a\", \"b\"], [\"c\", \"d\"]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 3) === [[0, 1, 2], [3, 4, 5]], 'chunk([0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 2) === [[0, 1], [2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 2) should return [[0, 1], [2, 3], [4, 5]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 4) === [[0, 1, 2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].');" + "assert(chunk([\"a\", \"b\", \"c\", \"d\"], 2) === [[\"a\", \"b\"], [\"c\", \"d\"]], '[\"a\", \"b\", \"c\", \"d\"], 2 should return [[\"a\", \"b\"], [\"c\", \"d\"]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 3) === [[0, 1, 2], [3, 4, 5]], '[0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 2) === [[0, 1], [2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 2 should return [[0, 1], [2, 3], [4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 4) === [[0, 1, 2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 4 should return [[0, 1, 2, 3], [4, 5]].');" ], "MDNlinks": [ "Array.push()" @@ -449,7 +449,7 @@ "difficulty": "1.11", "description": [ "Return the remaining elements of an array after chopping off n elements from the head.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function slasher(arr, howMany) {", @@ -457,12 +457,12 @@ " return arr;", "}", "", - "slasher([1, 2, 3], 2, '');" + "slasher([1, 2, 3], 2, \"\");" ], "tests": [ - "assert(slasher([1, 2, 3], 2) === [3]), 'slasher([1, 2, 3], 2), [3] should return [3].');", - "assert(slasher([1, 2, 3], 0) === [1, 2, 3]), 'slasher([1, 2, 3], 0) should return [1, 2, 3].');", - "assert(slasher([1, 2, 3], 9) === []), 'slasher([1, 2, 3], 9) should return [].');" + "assert(slasher([1, 2, 3], 2) === [3]), '[1, 2, 3], 2, [3] should return [3].');", + "assert(slasher([1, 2, 3], 0) === [1, 2, 3]), '[1, 2, 3], 0 should return [1, 2, 3].');", + "assert(slasher([1, 2, 3], 9) === []), '[1, 2, 3], 9 should return [].');" ], "MDNlinks": [ "Array.slice()", @@ -487,27 +487,27 @@ "difficulty": "1.12", "description": [ "Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.", - "For example, ['hello', 'Hello'], should return true because all of the letters in the second string are present in the first, ignoring case.", - "The arguments ['hello', 'hey'] should return false because the string 'hello' does not contain a 'y'.", - "Lastly, ['Alien', 'line'], should return true because all of the letters in 'line' are present in 'Alien'.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "For example, [\"hello\", \"Hello\"], should return true because all of the letters in the second string are present in the first, ignoring case.", + "The arguments [\"hello\", \"hey\"] should return false because the string \"hello\" does not contain a \"y\".", + "Lastly, [\"Alien\", \"line\"], should return true because all of the letters in \"line\" are present in \"Alien\".", + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function mutation(arr) {", " return arr;", "}", "", - "mutation(['hello', 'hey'], '');" + "mutation([\"hello\", \"hey\"], \"\");" ], "tests": [ - "assert(mutation(['hello', 'hey'])).to.be.false;", - "assert(mutation(['hello', 'Hello'])).to.be.true;", - "assert(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;", - "assert(mutation(['Mary', 'Army'])).to.be.true;", - "assert(mutation(['Mary', 'Aarmy'])).to.be.true;", - "assert(mutation(['Alien', 'line'])).to.be.true;", - "assert(mutation(['floor', 'for'])).to.be.true;", - "assert(mutation(['hello', 'neo'])).to.be.false;" + "assert(mutation([\"hello\", \"hey\"]) === false, '[\"hello\"&344; \"hey\"] should return false.');", + "assert(mutation([\"hello\", \"Hello\"]) === true, '[\"hello\"&344; \"Hello\"] should return true.');", + "assert(mutation([\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"]) === true, '[\"zyxwvutsrqponmlkjihgfedcba\"&344; \"qrstu\"] should return true.');", + "assert(mutation([\"Mary\", \"Army\"]) === true, '[\"Mary\"&344; \"Army\"] should return true.');", + "assert(mutation([\"Mary\", \"Aarmy\"]) === true, '[\"Mary\"&344; \"Aarmy\"] should return true.');", + "assert(mutation([\"Alien\", \"line\"]) === true, '[\"Alien\"&344; \"line\"] should return true.');", + "assert(mutation([\"floor\", \"for\"]) === true, '[\"floor\"&344; \"for\"] should return true.');", + "assert(mutation([\"hello\", \"neo\"]) === false, '[\"hello\"&344; \"neo\"] should return false.');" ], "MDNlinks": [ "Array.indexOf()" @@ -532,7 +532,7 @@ "description": [ "Remove all falsey values from an array.", "Falsey values in javascript are false, null, 0, \"\", undefined, and NaN.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function bouncer(arr) {", @@ -540,12 +540,12 @@ " return arr;", "}", "", - "bouncer([7, 'ate', '', false, 9], '');" + "bouncer([7, \"ate\", \"\", false, 9], \"\");" ], "tests": [ - "assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values', '');", - "assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements', '');", - "assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey', '');" + "assert(bouncer([7, \"ate\", \"\", false, 9]) === [7, \"ate\", 9], '[7&344; \"ate\"&344; \"\"&344; false&344; 9] should return [7&344; \"ate\"&344; 9].');", + "assert(bouncer([\"a\", \"b\", \"c\"]) === [\"a\", \"b\", \"c\"], '[\"a\"&344; \"b\"&344; \"c\"] should return [\"a\"&344; \"b\"&344; \"c\"].');", + "assert(bouncer([false, null, 0]) === [], '[false&344; null&344; 0] should return [].');" ], "MDNlinks": [ "Boolean Objects", @@ -570,7 +570,7 @@ "difficulty": "1.55", "description": [ "Make a function that looks through an array (first argument) and returns an array of all objects that have equivalent property values (second argument).", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function where(collection, source) {", @@ -579,11 +579,11 @@ " return arr;", "}", "", - "where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }, '');" + "where([{ first: \"Romeo\", last: \"Montague\" }, { first: \"Mercutio\", last: null }, { first: \"Tybalt\", last: \"Capulet\" }], { last: \"Capulet\" }, \"\");" ], "tests": [ - "assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects', '');", - "assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples', '');" + "assert(where([{ first: \"Romeo\", last: \"Montague\" }, { first: \"Mercutio\", last: null }, { first: \"Tybalt\", last: \"Capulet\" }], { last: \"Capulet\" }) === [{ first: \"Tybalt\", last: \"Capulet\" }], '[{ first: \"Romeo\"&344; last: \"Montague\" }&344; { first: \"Mercutio\"&344; last: null }&344; { first: \"Tybalt\"&344; last: \"Capulet\" }]&344; { last: \"Capulet\" } should return [{ first: \"Tybalt\"&344; last: \"Capulet\" }].');", + "assert(where([{ \"a\": 1 }, { \"a\": 1 }, { \"a\": 1, \"b\": 2 }], { \"a\": 1 }) === [{ \"a\": 1 }, { \"a\": 1 }, { \"a\": 1, \"b\": 2 }], '[{ \"a\": 1 }&344; { \"a\": 1 }&344; { \"a\": 1&344; \"b\": 2 }]&344; { \"a\": 1 } should return [{ \"a\": 1 }&344; { \"a\": 1 }&344; { \"a\": 1&344; \"b\": 2 }].');" ], "MDNlinks": [ "Global Object", @@ -609,7 +609,7 @@ "difficulty": "1.60", "description": [ "You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function destroyer(arr) {", @@ -617,14 +617,14 @@ " return arr;", "}", "", - "destroyer([1, 2, 3, 1, 2, 3], 2, 3, '');" + "destroyer([1, 2, 3, 1, 2, 3], 2, 3, \"\");" ], "tests": [ - "assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array', '');", - "assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array', '');", - "assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], 'should accept more than two additional arguments', '');", - "assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], 'should remove correct values from an array', '');", - "assert.deepEqual(destroyer(['tree', 'hamburger', 53], 'tree', 53), ['hamburger'], 'should handle NaN-elements', '');" + "assert(destroyer([1, 2, 3, 1, 2, 3], 2, 3) === [1, 1], '[1&344; 2&344; 3&344; 1&344; 2&344; 3]&344; 2&344; 3 should return [1&344; 1]');", + "assert(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) === [1, 5, 1], '[1, 2, 3, 5, 1, 2, 3], 2, 3 should return [1, 5, 1].');", + "assert(destroyer([3, 5, 1, 2, 2], 2, 3, 5) === [1], '[3, 5, 1, 2, 2], 2, 3, 5 should return [1].');", + "assert(destroyer([2, 3, 2, 3], 2, 3) === [], '[2, 3, 2, 3], 2, 3 should return [].');", + "assert(destroyer([\"tree\", \"hamburger\", 53], \"tree\", 53) === [\"hamburger\"], '[\"tree\", \"hamburger\", 53], \"tree\", 53) should return [\"hamburger\"].');" ], "MDNlinks": [ "Arguments object", @@ -650,7 +650,7 @@ "description": [ "Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).", "For example, where([1,2,3,4], 1.5) should return 1 because it is greater than 1 (0th index), but less than 2 (1st index).", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function where(arr, num) {", @@ -658,14 +658,14 @@ " return num;", "}", "", - "where([40, 60], 50, '');" + "where([40, 60], 50, \"\");" ], "MDNlinks": [ "Array.sort()" ], "tests": [ - "assert(where([10, 20, 30, 40, 50], 35) === 3, '');", - "assert(where([10, 20, 30, 40, 50], 30) === 2, '');" + "assert(where([10, 20, 30, 40, 50], 35) === 3, '[10, 20, 30, 40, 50], 35 should return 3.');", + "assert(where([10, 20, 30, 40, 50], 30) === 2, '[10, 20, 30, 40, 50], 30) should return 2.');" ], "type": "bonfire", "challengeType": 5, From f88cce89399547b1b6e7678d4f7d27a981b6dd29 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Fri, 28 Aug 2015 04:38:56 -0700 Subject: [PATCH 5/9] start modifying intermediate bonfires --- seed/challenges/intermediate-bonfires.json | 162 ++++++++++----------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/seed/challenges/intermediate-bonfires.json b/seed/challenges/intermediate-bonfires.json index 80adf23020..aa63b11576 100644 --- a/seed/challenges/intermediate-bonfires.json +++ b/seed/challenges/intermediate-bonfires.json @@ -19,11 +19,11 @@ "sumAll([1, 4]);" ], "tests": [ - "expect(sumAll([1, 4])).to.be.a('Number');", - "expect(sumAll([1, 4])).to.equal(10);", - "expect(sumAll([4, 1])).to.equal(10);", - "expect(sumAll([5, 10])).to.equal(45);", - "expect(sumAll([10, 5])).to.equal(45);" + "assert(typeof(sumAll([1, 4])) === 'number', '.');", + "assert(sumAll([1, 4]) === 10, '[1, 4] should return 10.');", + "assert(sumAll([4, 1]) === 10, '[4, 1] should return 10.');", + "assert(sumAll([5, 10]) === 45, '[5, 10] should return 45.');", + "assert(sumAll([10, 5]) === 45, '[10, 5] should return 45';" ], "MDNlinks": [ "Math.max()", @@ -61,13 +61,13 @@ "diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);" ], "tests": [ - "expect(diff([1, 2, 3, 5], [1, 2, 3, 4, 5])).to.be.a('array');", - "assert.deepEqual(diff(['diorite', 'andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']), ['pink wool'], 'arrays with only one difference');", - "assert.includeMembers(diff(['andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']), ['diorite', 'pink wool'], 'arrays with more than one difference');", - "assert.deepEqual(diff(['andesite', 'grass', 'dirt', 'dead shrub'], ['andesite', 'grass', 'dirt', 'dead shrub']), [], 'arrays with no difference');", - "assert.deepEqual(diff([1, 2, 3, 5], [1, 2, 3, 4, 5]), [4], 'arrays with numbers');", - "assert.includeMembers(diff([1, 'calf', 3, 'piglet'], [1, 'calf', 3, 4]), ['piglet', 4], 'arrays with numbers and strings');", - "assert.deepEqual(diff([], ['snuffleupagus', 'cookie monster', 'elmo']), ['snuffleupagus', 'cookie monster', 'elmo'], 'empty array');" + "assert(typeof(diff([1, 2, 3, 5], [1, 2, 3, 4, 5])) === 'array', 'diff() should return an array.');", + "assert(diff(['diorite', 'andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']) === ['pink wool'], '['diorite', 'andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub'] should return ['pink wool'].');", + "assert(diff(['andesite', 'grass', 'dirt', 'dead shrub'], ['andesite', 'grass', 'dirt', 'dead shrub']), [], 'arrays with no difference', '.');", + "assert(diff([1, 2, 3, 5], [1, 2, 3, 4, 5]) === [4], 'arrays with numbers', '.');", + "assert(diff([], ['snuffleupagus', 'cookie monster', 'elmo']), ['snuffleupagus', 'cookie monster', 'elmo'], 'empty array');", + "assert.includeMembers(diff([1, 'calf', 3, 'piglet'], [1, 'calf', 3, 4]), ['piglet', 4], 'arrays with numbers and strings', '.');", + "assert.includeMembers(diff(['andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']), ['diorite', 'pink wool'], 'arrays with more than one difference', '.');" ], "MDNlinks": [ "Comparison Operators", @@ -93,11 +93,11 @@ "id": "a7f4d8f2483413a6ce226cac", "title": "Roman Numeral Converter", "tests": [ - "expect(convert(12)).to.equal(\"XII\");", - "expect(convert(5)).to.equal(\"V\");", - "expect(convert(9)).to.equal(\"IX\");", - "expect(convert(29)).to.equal(\"XXIX\");", - "expect(convert(16)).to.equal(\"XVI\");" + "assert(convert(12) === \"XII\");", + "assert(convert(5) === \"V\");", + "assert(convert(9) === \"IX\");", + "assert(convert(29) === \"XXIX\");", + "assert(convert(16) === \"XVI\");" ], "difficulty": "2.02", "description": [ @@ -134,11 +134,11 @@ "id": "a0b5010f579e69b815e7c5d6", "title": "Search and Replace", "tests": [ - "expect(replace(\"Let us go to the store\", \"store\", \"mall\")).to.equal(\"Let us go to the mall\");", - "expect(replace(\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\")).to.equal(\"He is Sitting on the couch\");", - "expect(replace(\"This has a spellngi error\", \"spellngi\", \"spelling\")).to.equal(\"This has a spelling error\");", - "expect(replace(\"His name is Tom\", \"Tom\", \"john\")).to.equal(\"His name is John\");", - "expect(replace(\"Let us get back to more Coding\", \"Coding\", \"bonfires\")).to.equal(\"Let us get back to more Bonfires\");" + "assert(replace(\"Let us go to the store\", \"store\", \"mall\") === \"Let us go to the mall\", '.');", + "assert(replace(\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\") === \"He is Sitting on the couch\", '.');", + "assert(replace(\"This has a spellngi error\", \"spellngi\", \"spelling\") === \"This has a spelling error\", '.');", + "assert(replace(\"His name is Tom\", \"Tom\", \"john\") === \"His name is John\", '.');", + "assert(replace(\"Let us get back to more Coding\", \"Coding\", \"bonfires\") === \"Let us get back to more Bonfires\");" ], "difficulty": "2.03", "description": [ @@ -178,11 +178,11 @@ "id": "aa7697ea2477d1316795783b", "title": "Pig Latin", "tests": [ - "expect(translate(\"california\")).to.equal(\"aliforniacay\");", - "expect(translate(\"paragraphs\")).to.equal(\"aragraphspay\");", - "expect(translate(\"glove\")).to.equal(\"oveglay\");", - "expect(translate(\"algorithm\")).to.equal(\"algorithmway\");", - "expect(translate(\"eight\")).to.equal(\"eightway\");" + "assert(translate(\"california\") === \"aliforniacay\", '.');", + "assert(translate(\"paragraphs\") === \"aragraphspay\", '.');", + "assert(translate(\"glove\") === \"oveglay\", '.');", + "assert(translate(\"algorithm\") === \"algorithmway\", '.');", + "assert(translate(\"eight\") === \"eightway\");" ], "difficulty": "2.04", "description": [ @@ -222,8 +222,8 @@ "id": "afd15382cdfb22c9efe8b7de", "title": "DNA Pairing", "tests": [ - "assert.deepEqual(pair(\"ATCGA\"),[['A','T'],['T','A'],['C','G'],['G','C'],['A','T']], 'should return the dna pair');", - "assert.deepEqual(pair(\"TTGAG\"),[['T','A'],['T','A'],['G','C'],['A','T'],['G','C']], 'should return the dna pair');", + "assert.deepEqual(pair(\"ATCGA\"),[['A','T'],['T','A'],['C','G'],['G','C'],['A','T']], 'should return the dna pair', '.');", + "assert.deepEqual(pair(\"TTGAG\"),[['T','A'],['T','A'],['G','C'],['A','T'],['G','C']], 'should return the dna pair', '.');", "assert.deepEqual(pair(\"CTCTA\"),[['C','G'],['T','A'],['C','G'],['T','A'],['A','T']], 'should return the dna pair');" ], "difficulty": "2.05", @@ -276,10 +276,10 @@ "fearNotLetter('abce');" ], "tests": [ - "expect(fearNotLetter('abce')).to.equal('d');", - "expect(fearNotLetter('bcd')).to.be.undefined;", - "expect(fearNotLetter('abcdefghjklmno')).to.equal('i');", - "expect(fearNotLetter('yz')).to.be.undefined;" + "assert(fearNotLetter('abce') === 'd', '.');", + "assert(fearNotLetter('bcd')).to.be.undefined;", + "assert(fearNotLetter('abcdefghjklmno') === 'i', '.');", + "assert(fearNotLetter('yz')).to.be.undefined;" ], "MDNlinks": [ "String.charCodeAt()", @@ -316,13 +316,13 @@ "boo(null);" ], "tests": [ - "assert.strictEqual(boo(true), true);", - "assert.strictEqual(boo(false), true);", - "assert.strictEqual(boo([1, 2, 3]), false);", - "assert.strictEqual(boo([].slice), false);", - "assert.strictEqual(boo({ 'a': 1 }), false);", - "assert.strictEqual(boo(1), false);", - "assert.strictEqual(boo(NaN), false);", + "assert.strictEqual(boo(true), true, '.');", + "assert.strictEqual(boo(false), true, '.');", + "assert.strictEqual(boo([1, 2, 3]), false, '.');", + "assert.strictEqual(boo([].slice), false, '.');", + "assert.strictEqual(boo({ 'a': 1 }), false, '.');", + "assert.strictEqual(boo(1), false, '.');", + "assert.strictEqual(boo(NaN), false, '.');", "assert.strictEqual(boo('a'), false);" ], "MDNlinks": [ @@ -360,9 +360,9 @@ "unite([1, 3, 2], [5, 2, 1, 4], [2, 1]);" ], "tests": [ - "assert.deepEqual(unite([1, 3, 2], [5, 2, 1, 4], [2, 1]), [1, 3, 2, 5, 4], 'should return the union of the given arrays');", - "assert.deepEqual(unite([1, 3, 2], [1, [5]], [2, [4]]), [1, 3, 2, [5], [4]], 'should not flatten nested arrays');", - "assert.deepEqual(unite([1, 2, 3], [5, 2, 1]), [1, 2, 3, 5], 'should correctly handle exactly two arguments');", + "assert.deepEqual(unite([1, 3, 2], [5, 2, 1, 4], [2, 1]), [1, 3, 2, 5, 4], 'should return the union of the given arrays', '.');", + "assert.deepEqual(unite([1, 3, 2], [1, [5]], [2, [4]]), [1, 3, 2, [5], [4]], 'should not flatten nested arrays', '.');", + "assert.deepEqual(unite([1, 2, 3], [5, 2, 1]), [1, 2, 3, 5], 'should correctly handle exactly two arguments', '.');", "assert.deepEqual(unite([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]), [ 1, 2, 3, 5, 4, 6, 7, 8 ], 'should correctly handle higher numbers of arguments');" ], "MDNlinks": [ @@ -399,12 +399,12 @@ "convert('Dolce & Gabbana');" ], "tests": [ - "assert.match(convert('Dolce & Gabbana'), /Dolce &(amp|AMP|#x00026|#38); Gabbana/, 'should escape characters');", - "assert.match(convert('Hamburgers < Pizza < Tacos'), /Hamburgers &(lt|LT|#x0003C|#60); Pizza &(lt|LT|#x0003C|#60); Tacos/, 'should escape characters');", - "assert.match(convert('Sixty > twelve'), /Sixty &(gt|GT|#x0003E|#62); twelve/, 'should escape characters');", - "assert.match(convert('Stuff in \"quotation marks\"'), /Stuff in &(quot|QUOT|#x00022|#34);quotation marks&(quot|QUOT|#x00022|#34);/, 'should escape characters');", - "assert.match(convert(\"Shindler's List\"), /Shindler&(apos|#x00027|#39);s List/, 'should escape characters');", - "assert.match(convert('<>'), /&(lt|LT|#x0003C|#60);&(gt|GT|#x0003E|#62);/, 'should escape characters');", + "assert.match(convert('Dolce & Gabbana'), /Dolce &(amp|AMP|#x00026|#38); Gabbana/, 'should escape characters', '.');", + "assert.match(convert('Hamburgers < Pizza < Tacos'), /Hamburgers &(lt|LT|#x0003C|#60); Pizza &(lt|LT|#x0003C|#60); Tacos/, 'should escape characters', '.');", + "assert.match(convert('Sixty > twelve'), /Sixty &(gt|GT|#x0003E|#62); twelve/, 'should escape characters', '.');", + "assert.match(convert('Stuff in \"quotation marks\"'), /Stuff in &(quot|QUOT|#x00022|#34);quotation marks&(quot|QUOT|#x00022|#34);/, 'should escape characters', '.');", + "assert.match(convert(\"Shindler's List\"), /Shindler&(apos|#x00027|#39);s List/, 'should escape characters', '.');", + "assert.match(convert('<>'), /&(lt|LT|#x0003C|#60);&(gt|GT|#x0003E|#62);/, 'should escape characters', '.');", "assert.strictEqual(convert('abc'), 'abc', 'should handle strings with nothing to escape');" ], "MDNlinks": [ @@ -442,9 +442,9 @@ "spinalCase('This Is Spinal Tap');" ], "tests": [ - "assert.strictEqual(spinalCase('This Is Spinal Tap'), 'this-is-spinal-tap', 'should return spinal case from string with spaces');", - "assert.strictEqual(spinalCase('thisIsSpinalTap'), 'this-is-spinal-tap', 'should return spinal case from string with camel case');", - "assert.strictEqual(spinalCase('The_Andy_Griffith_Show'), 'the-andy-griffith-show', 'should return spinal case from string with snake case');", + "assert.strictEqual(spinalCase('This Is Spinal Tap'), 'this-is-spinal-tap', 'should return spinal case from string with spaces', '.');", + "assert.strictEqual(spinalCase('thisIsSpinalTap'), 'this-is-spinal-tap', 'should return spinal case from string with camel case', '.');", + "assert.strictEqual(spinalCase('The_Andy_Griffith_Show'), 'the-andy-griffith-show', 'should return spinal case from string with snake case', '.');", "assert.strictEqual(spinalCase('Teletubbies say Eh-oh'), 'teletubbies-say-eh-oh', 'should return spinal case from string with spaces and hyphens');" ], "MDNlinks": [ @@ -482,12 +482,12 @@ "sumFibs(4);" ], "tests": [ - "expect(sumFibs(1)).to.be.a('number');", - "expect(sumFibs(1000)).to.equal(1785);", - "expect(sumFibs(4000000)).to.equal(4613732);", - "expect(sumFibs(4)).to.equal(5);", - "expect(sumFibs(75024)).to.equal(60696);", - "expect(sumFibs(75025)).to.equal(135721);" + "assert(sumFibs(1)).to.be.a('number', '.');", + "assert(sumFibs(1000) === 1785, '.');", + "assert(sumFibs(4000000) === 4613732, '.');", + "assert(sumFibs(4) === 5, '.');", + "assert(sumFibs(75024) === 60696, '.');", + "assert(sumFibs(75025) === 135721);" ], "MDNlinks": [ "Remainder" @@ -523,9 +523,9 @@ "sumPrimes(10);" ], "tests": [ - "expect(sumPrimes(10)).to.be.a('number');", - "expect(sumPrimes(10)).to.equal(17);", - "expect(sumPrimes(977)).to.equal(73156);" + "assert(sumPrimes(10)).to.be.a('number', '.');", + "assert(sumPrimes(10) === 17, '.');", + "assert(sumPrimes(977) === 73156);" ], "MDNlinks": [ "For Loops", @@ -563,10 +563,10 @@ "smallestCommons([1,5]);" ], "tests": [ - "expect(smallestCommons([1,5])).to.be.a('number');", - "expect(smallestCommons([1,5])).to.equal(60);", - "expect(smallestCommons([5,1])).to.equal(60);", - "expect(smallestCommons([1,13])).to.equal(360360);" + "assert(smallestCommons([1,5])).to.be.a('number', '.');", + "assert(smallestCommons([1,5]) === 60, '.');", + "assert(smallestCommons([5,1]) === 60, '.');", + "assert(smallestCommons([1,13]) === 360360);" ], "MDNlinks": [ "Smallest Common Multiple" @@ -601,7 +601,7 @@ "find([1, 2, 3, 4], function(num){ return num % 2 === 0; });" ], "tests": [ - "assert.strictEqual(find([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, 'should return first found value');", + "assert.strictEqual(find([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, 'should return first found value', '.');", "assert.strictEqual(find([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, 'should return undefined if not found');" ], "MDNlinks": [ @@ -637,9 +637,9 @@ "drop([1, 2, 3], function(n) {return n < 3; });" ], "tests": [ - "expect(drop([1, 2, 3, 4], function(n) {return n >= 3; })).to.eqls([3, 4]);", - "expect(drop([1, 2, 3], function(n) {return n > 0; })).to.eqls([1, 2, 3]);", - "expect(drop([1, 2, 3, 4], function(n) {return n > 5; })).to.eqls([]);" + "assert(drop([1, 2, 3, 4], function(n) {return n >= 3; })).to.eqls([3, 4], '.');", + "assert(drop([1, 2, 3], function(n) {return n > 0; })).to.eqls([1, 2, 3], '.');", + "assert(drop([1, 2, 3, 4], function(n) {return n > 5; })).to.eqls([]);" ], "MDNlinks": [ "Arguments object", @@ -675,9 +675,9 @@ "steamroller([1, [2], [3, [[4]]]]);" ], "tests": [ - "assert.deepEqual(steamroller([[['a']], [['b']]]), ['a', 'b'], 'should flatten nested arrays');", - "assert.deepEqual(steamroller([1, [2], [3, [[4]]]]), [1, 2, 3, 4], 'should flatten nested arrays');", - "assert.deepEqual(steamroller([1, [], [3, [[4]]]]), [1, 3, 4], 'should work with empty arrays');", + "assert.deepEqual(steamroller([[['a']], [['b']]]), ['a', 'b'], 'should flatten nested arrays', '.');", + "assert.deepEqual(steamroller([1, [2], [3, [[4]]]]), [1, 2, 3, 4], 'should flatten nested arrays', '.');", + "assert.deepEqual(steamroller([1, [], [3, [[4]]]]), [1, 3, 4], 'should work with empty arrays', '.');", "assert.deepEqual(steamroller([1, {}, [3, [[4]]]]), [1, {}, 3, 4], 'should work with actual objects');" ], "MDNlinks": [ @@ -713,8 +713,8 @@ "binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111');" ], "tests": [ - "expect(binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111')).to.equal(\"Aren't bonfires fun!?\");", - "expect(binaryAgent('01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000110 01110010 01100101 01100101 01000011 01101111 01100100 01100101 01000011 01100001 01101101 01110000 00100001')).to.equal(\"I love FreeCodeCamp!\");" + "assert(binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111') === \"Aren't bonfires fun!?\", '.');", + "assert(binaryAgent('01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000110 01110010 01100101 01100101 01000011 01101111 01100100 01100101 01000011 01100001 01101101 01110000 00100001') === \"I love FreeCodeCamp!\");" ], "MDNlinks": [ "String.charCodeAt()", @@ -752,8 +752,8 @@ "every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex');" ], "tests": [ - "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex'), true, 'should return true if predicate returns truthy for all elements in the collection');", - "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], {'sex': 'female'}), false, 'should return false if predicate returns falsey for any element in the collection');", + "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex'), true, 'should return true if predicate returns truthy for all elements in the collection', '.');", + "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], {'sex': 'female'}), false, 'should return false if predicate returns falsey for any element in the collection', '.');", "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'female'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], {'sex': 'female'}), false, 'should return false if predicate returns falsey for any element in the collection');" ], "MDNlinks": [ @@ -791,11 +791,11 @@ "add(2,3);" ], "tests": [ - "expect(add(2, 3)).to.equal(5);", - "expect(add(2)(3)).to.equal(5);", - "expect(add('http://bit.ly/IqT6zt')).to.be.undefined;", - "expect(add(2, '3')).to.be.undefined;", - "expect(add(2)([3])).to.be.undefined;" + "assert(add(2, 3) === 5, '.');", + "assert(add(2)(3) === 5, '.');", + "assert(add('http://bit.ly/IqT6zt')).to.be.undefined;", + "assert(add(2, '3')).to.be.undefined;", + "assert(add(2)([3])).to.be.undefined;" ], "MDNlinks": [ "Global Function Object", From 3c88c69c184c2594340198e3e7a652f755f80e94 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Mon, 31 Aug 2015 23:56:07 -0700 Subject: [PATCH 6/9] continue work refactoring intermediate-bonfires --- seed/challenges/intermediate-bonfires.json | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/seed/challenges/intermediate-bonfires.json b/seed/challenges/intermediate-bonfires.json index aa63b11576..f71e33b368 100644 --- a/seed/challenges/intermediate-bonfires.json +++ b/seed/challenges/intermediate-bonfires.json @@ -134,11 +134,11 @@ "id": "a0b5010f579e69b815e7c5d6", "title": "Search and Replace", "tests": [ - "assert(replace(\"Let us go to the store\", \"store\", \"mall\") === \"Let us go to the mall\", '.');", - "assert(replace(\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\") === \"He is Sitting on the couch\", '.');", - "assert(replace(\"This has a spellngi error\", \"spellngi\", \"spelling\") === \"This has a spelling error\", '.');", - "assert(replace(\"His name is Tom\", \"Tom\", \"john\") === \"His name is John\", '.');", - "assert(replace(\"Let us get back to more Coding\", \"Coding\", \"bonfires\") === \"Let us get back to more Bonfires\");" + "assert(replace(\"Let us go to the store\", \"store\", \"mall\") === \"Let us go to the mall\", '\"Let us go to the store\", \"store\", \"mall\" should return \"Let us go to the mall\", '\"Let us go to the store\", \"store\".');", + "assert(replace(\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\") === \"He is Sitting on the couch\", '\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\" should return \"He is Sitting on the couch\".');", + "assert(replace(\"This has a spellngi error\", \"spellngi\", \"spelling\") === \"This has a spelling error\", '\"This has a spellngi error\", \"spellngi\", \"spelling\" should return \"This has a spelling error\".');", + "assert(replace(\"His name is Tom\", \"Tom\", \"john\") === \"His name is John\", '\"His name is Tom\", \"Tom\", \"john\" should return \"His name is John\".');", + "assert(replace(\"Let us get back to more Coding\", \"Coding\", \"bonfires\") === \"Let us get back to more Bonfires\"), '\"Let us get back to more Coding\", \"Coding\", \"bonfires\" should return \"Let us get back to more Bonfires\"');" ], "difficulty": "2.03", "description": [ @@ -178,11 +178,11 @@ "id": "aa7697ea2477d1316795783b", "title": "Pig Latin", "tests": [ - "assert(translate(\"california\") === \"aliforniacay\", '.');", - "assert(translate(\"paragraphs\") === \"aragraphspay\", '.');", - "assert(translate(\"glove\") === \"oveglay\", '.');", - "assert(translate(\"algorithm\") === \"algorithmway\", '.');", - "assert(translate(\"eight\") === \"eightway\");" + "assert(translate(\"california\") === \"aliforniacay\", '\"california\" should return \"aliforniacay\".');", + "assert(translate(\"paragraphs\") === \"aragraphspay\", '\"paragraphs\" should return \"aragraphspay\".');", + "assert(translate(\"glove\") === \"oveglay\", '\"glove\" should return \"oveglay\".');", + "assert(translate(\"algorithm\") === \"algorithmway\", '\"algorithm\" should return \"algorithmway\".');", + "assert(translate(\"eight\") === \"eightway\"), '\"eight\" should return \"eightway\".');" ], "difficulty": "2.04", "description": [ @@ -222,9 +222,9 @@ "id": "afd15382cdfb22c9efe8b7de", "title": "DNA Pairing", "tests": [ - "assert.deepEqual(pair(\"ATCGA\"),[['A','T'],['T','A'],['C','G'],['G','C'],['A','T']], 'should return the dna pair', '.');", - "assert.deepEqual(pair(\"TTGAG\"),[['T','A'],['T','A'],['G','C'],['A','T'],['G','C']], 'should return the dna pair', '.');", - "assert.deepEqual(pair(\"CTCTA\"),[['C','G'],['T','A'],['C','G'],['T','A'],['A','T']], 'should return the dna pair');" + "assert(pair(\"ATCGA\") === [['A','T'],['T','A'],['C','G'],['G','C'],['A','T']], '\"ATCGA\" should return [['A','T'],['T','A'],['C','G'],['G','C'],['A','T']].');", + "assert(pair(\"TTGAG\") === [['T','A'],['T','A'],['G','C'],['A','T'],['G','C']], '\"TTGAG\" should return [['T','A'],['T','A'],['G','C'],['A','T'],['G','C']].');", + "assert(pair(\"CTCTA\") === [['C','G'],['T','A'],['C','G'],['T','A'],['A','T']], '\"CTCTA\" should return [['C','G'],['T','A'],['C','G'],['T','A'],['A','T']].');" ], "difficulty": "2.05", "description": [ @@ -277,9 +277,9 @@ ], "tests": [ "assert(fearNotLetter('abce') === 'd', '.');", - "assert(fearNotLetter('bcd')).to.be.undefined;", + "assert(fearNotLetter('bcd')) === undefined, '.');", "assert(fearNotLetter('abcdefghjklmno') === 'i', '.');", - "assert(fearNotLetter('yz')).to.be.undefined;" + "assert(fearNotLetter('yz')) === undefined, '.');" ], "MDNlinks": [ "String.charCodeAt()", From 98ed941384f485433afa2e81785db78ae7f5899e Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Mon, 14 Sep 2015 13:43:04 -0700 Subject: [PATCH 7/9] most of the basic bonfires have running tests --- seed/challenges/basic-bonfires.json | 59 +++++++++++++------------- server/views/coursewares/showHTML.jade | 6 --- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 8ff06201ee..6acddd1518 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -145,7 +145,6 @@ "assert(palindrome(\"nope\") === false, '\"nope\" should return false.');", "assert(palindrome(\"almostomla\") === false, '\"almostomla\" should return false.');", "assert(palindrome(\"My age is 0, 0 si ega ym.\") === true, '\"My age is 0, 0 si ega ym.\" should return true.');", - "assert(palindrome(\"I'm 23 non 32 m'I?\") === true, '\"I'm 23 non 32 m'I?\" should return true.');", "assert(palindrome(\"1 eye for of 1 eye.\") === false, '\"1 eye for of 1 eye.\" should return false.');", "assert(palindrome(\"0_0 (: /-\\ :) 0-0\") === true, '\"0_0 (: /-\\\\ :) 0-0\" should return true.');" ], @@ -193,7 +192,7 @@ "findLongestWord(\"The quick brown fox jumped over the lazy dog\");" ], "tests": [ - "assert(typeOf(findLongestWord(\"The quick brown fox jumped over the lazy dog\")) === \"number\", 'findLongestWord() should return a number.');", + "assert(typeof(findLongestWord(\"The quick brown fox jumped over the lazy dog\")) === \"number\", 'findLongestWord() should return a number.');", "assert(findLongestWord(\"The quick brown fox jumped over the lazy dog\") === 6, '\"The quick brown fox jumped over the lazy dog\" should return 6.');", "assert(findLongestWord(\"May the force be with you\") === 5, '\"May the force be with you\" should return 5.');", "assert(findLongestWord(\"Google do a barrel roll\") === 6, '\"Google do a barrel roll\" should return 6.');", @@ -234,8 +233,8 @@ "titleCase(\"I'm a little tea pot\", \"\");" ], "tests": [ - "assert(typeOf(titleCase(\"I'm a little tea pot\")) === \"String\", 'titleCase() should return a string.');", - "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '\"I'm a little tea pot\" should return \"I'm A Little Tea Pot\".');", + "assert(typeof(titleCase(\"I'm a little tea pot\")) === \"string\", 'titleCase() should return a string.');", + "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '\"I'm a little tea pot\" should return \"I'm A Little Tea Pot\".');", "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '\"sHoRt AnD sToUt\" should return \"Short And Stout\".');", "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '\"HERE IS MY HANDLE HERE IS MY SPOUT\" should return \"Here Is My Handle Here Is My Spout\"');" ], @@ -274,9 +273,9 @@ "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]], \"\");" ], "tests": [ - "assert(typeOf(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === \"array\", 'largestOfFour() should return an array.');", - "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]) === [27,5,39,1001], '[[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]] should return [27&344;5&344;39&344;1001].');", - "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) === [9,35,97,1000000], '[[4&344; 9&344; 1&344; 3]&344; [13&344; 35&344; 18&344; 26]&344; [32&344; 35&344; 97&344; 39]&344; [1000000&344; 1001&344; 857&344; 1]] should return [9&344;35&344;97&344;1000000].');" + "assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, 'largestOfFour() should return an array.');", + "assert(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]) === [27,5,39,1001], '[[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]] should return [27,5,39,1001].');", + "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) === [9,35,97,1000000], '[[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]] should return [9, 35, 97, 1000000].');" ], "MDNlinks": [ "Comparison Operators" @@ -312,9 +311,9 @@ "end(\"Bastian\", \"n\", \"\");" ], "tests": [ - "assert(end(\"Bastian\", \"n\") === true, 'end(\"Bastian\", \"n\") should return true.');", - "assert(end(\"Connor\", \"n\") === false, 'end(\"Connor\", \"n\") should return false.');", - "assert(end(\"Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\") === false, 'Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\") should return false.');", + "assert(end(\"Bastian\", \"n\") === true, '\"Bastian\", \"n\" should return true.');", + "assert(end(\"Connor\", \"n\") === false, '\"Connor\", \"n\" should return false.');", + "assert(end(\"Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\") === false, '\"Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\") should return false.');", "assert(end(\"He has to give me a new name\", \"name\") === true, '\"He has to give me a new name\", \"name\" should return true.');", "assert(end(\"If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing\", \"mountain\") === false, '\"If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing\", \"mountain\" should return false.');" ], @@ -351,7 +350,7 @@ "repeat(\"abc\", 3, \"\");" ], "tests": [ - "assert(repeat(\"*\", 3) === \"***\", '\"*\", 3 should return \"***\".);", + "assert(repeat(\"*\", 3) === \"***\", '\"*\", 3 should return \"***\".');", "assert(repeat(\"abc\", 3) === \"abcabcabc\", '\"abc\", 3 should return \"abcabcabc\".');", "assert(repeat(\"abc\", -2) === \"\", '\"abc\", -2 should return \"\".');" ], @@ -390,9 +389,9 @@ ], "tests": [ "assert(truncate(\"A-tisket a-tasket A green and yellow basket\", 11) === \"A-tisket...\", '\"A-tisket a-tasket A green and yellow basket\", 1 should return \"A-tisket...\".');", - "assert(truncate(\"Peter Piper picked a peck of pickled peppers\", 14) === \"Peter Piper...\", '\"Peter Piper picked a peck of pickled peppers\", 14 should return \"Peter Piper...\".);", + "assert(truncate(\"Peter Piper picked a peck of pickled peppers\", 14) === \"Peter Piper...\", '\"Peter Piper picked a peck of pickled peppers\", 14 should return \"Peter Piper...\".');", "assert(truncate(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length) === \"A-tisket a-tasket A green and yellow basket\", '\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length) should return \"A-tisket a-tasket A green and yellow basket\".');", - "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2 === 'A-tisket a-tasket A green and yellow basket', '\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length + 2 should return \"A-tisket a-tasket A green and yellow basket\".);" + "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2) === 'A-tisket a-tasket A green and yellow basket', '\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length + 2 should return \"A-tisket a-tasket A green and yellow basket\".');" ], "MDNlinks": [ "String.slice()" @@ -465,9 +464,9 @@ "slasher([1, 2, 3], 2, \"\");" ], "tests": [ - "assert(slasher([1, 2, 3], 2) === [3]), '[1, 2, 3], 2, [3] should return [3].');", - "assert(slasher([1, 2, 3], 0) === [1, 2, 3]), '[1, 2, 3], 0 should return [1, 2, 3].');", - "assert(slasher([1, 2, 3], 9) === []), '[1, 2, 3], 9 should return [].');" + "assert(slasher([1, 2, 3], 2) === [3], '[1, 2, 3], 2, [3] should return [3].');", + "assert(slasher([1, 2, 3], 0) === [1, 2, 3], '[1, 2, 3], 0 should return [1, 2, 3].');", + "assert(slasher([1, 2, 3], 9) === [], '[1, 2, 3], 9 should return [].');" ], "MDNlinks": [ "Array.slice()", @@ -505,14 +504,14 @@ "mutation([\"hello\", \"hey\"], \"\");" ], "tests": [ - "assert(mutation([\"hello\", \"hey\"]) === false, '[\"hello\"&344; \"hey\"] should return false.');", - "assert(mutation([\"hello\", \"Hello\"]) === true, '[\"hello\"&344; \"Hello\"] should return true.');", - "assert(mutation([\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"]) === true, '[\"zyxwvutsrqponmlkjihgfedcba\"&344; \"qrstu\"] should return true.');", - "assert(mutation([\"Mary\", \"Army\"]) === true, '[\"Mary\"&344; \"Army\"] should return true.');", - "assert(mutation([\"Mary\", \"Aarmy\"]) === true, '[\"Mary\"&344; \"Aarmy\"] should return true.');", - "assert(mutation([\"Alien\", \"line\"]) === true, '[\"Alien\"&344; \"line\"] should return true.');", - "assert(mutation([\"floor\", \"for\"]) === true, '[\"floor\"&344; \"for\"] should return true.');", - "assert(mutation([\"hello\", \"neo\"]) === false, '[\"hello\"&344; \"neo\"] should return false.');" + "assert(mutation([\"hello\", \"hey\"]) === false, '[\"hello\", \"hey\"] should return false.');", + "assert(mutation([\"hello\", \"Hello\"]) === true, '[\"hello\", \"Hello\"] should return true.');", + "assert(mutation([\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"]) === true, '[\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"] should return true.');", + "assert(mutation([\"Mary\", \"Army\"]) === true, '[\"Mary\", \"Army\"] should return true.');", + "assert(mutation([\"Mary\", \"Aarmy\"]) === true, '[\"Mary\", \"Aarmy\"] should return true.');", + "assert(mutation([\"Alien\", \"line\"]) === true, '[\"Alien\", \"line\"] should return true.');", + "assert(mutation([\"floor\", \"for\"]) === true, '[\"floor\", \"for\"] should return true.');", + "assert(mutation([\"hello\", \"neo\"]) === false, '[\"hello\", \"neo\"] should return false.');" ], "MDNlinks": [ "Array.indexOf()" @@ -548,9 +547,9 @@ "bouncer([7, \"ate\", \"\", false, 9], \"\");" ], "tests": [ - "assert(bouncer([7, \"ate\", \"\", false, 9]) === [7, \"ate\", 9], '[7&344; \"ate\"&344; \"\"&344; false&344; 9] should return [7&344; \"ate\"&344; 9].');", - "assert(bouncer([\"a\", \"b\", \"c\"]) === [\"a\", \"b\", \"c\"], '[\"a\"&344; \"b\"&344; \"c\"] should return [\"a\"&344; \"b\"&344; \"c\"].');", - "assert(bouncer([false, null, 0]) === [], '[false&344; null&344; 0] should return [].');" + "assert(bouncer([7, \"ate\", \"\", false, 9]) === [7, \"ate\", 9], '[7, \"ate\", \"\", false, 9] should return [7, \"ate\", 9].');", + "assert(bouncer([\"a\", \"b\", \"c\"]) === [\"a\", \"b\", \"c\"], '[\"a\", \"b\", \"c\"] should return [\"a\", \"b\", \"c\"].');", + "assert(bouncer([false, null, 0]) === [], '[false, null, 0] should return [].');" ], "MDNlinks": [ "Boolean Objects", @@ -586,7 +585,7 @@ "destroyer([1, 2, 3, 1, 2, 3], 2, 3, \"\");" ], "tests": [ - "assert(destroyer([1, 2, 3, 1, 2, 3], 2, 3) === [1, 1], '[1&344; 2&344; 3&344; 1&344; 2&344; 3]&344; 2&344; 3 should return [1&344; 1]');", + "assert(destroyer([1, 2, 3, 1, 2, 3], 2, 3) === [1, 1], '[1, 2, 3, 1, 2, 3], 2, 3 should return [1, 1].');", "assert(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) === [1, 5, 1], '[1, 2, 3, 5, 1, 2, 3], 2, 3 should return [1, 5, 1].');", "assert(destroyer([3, 5, 1, 2, 2], 2, 3, 5) === [1], '[3, 5, 1, 2, 2], 2, 3, 5 should return [1].');", "assert(destroyer([2, 3, 2, 3], 2, 3) === [], '[2, 3, 2, 3], 2, 3 should return [].');", @@ -632,8 +631,8 @@ "tests": [ "assert(where([10, 20, 30, 40, 50], 35) === 3, '[10, 20, 30, 40, 50], 35 should return 3.');", "assert(where([10, 20, 30, 40, 50], 30) === 2, '[10, 20, 30, 40, 50], 30) should return 2.');", - "assert(where([40, 60], 50) === 1, '[40, 60,], 50 should return 1');", - "assert(where([5, 3, 20, 3], 3) === 0, '[5, 3, 20, 3], 3 should return 0/');", + "assert(where([40, 60], 50) === 1, '[40, 60,], 50 should return 1.');", + "assert(where([5, 3, 20, 3], 3) === 0, '[5, 3, 20, 3], 3 should return 0.');", "assert(where([2, 20, 10], 1) === 0, '[2, 20, 10], 1 should return 0.');", "assert(where([2, 5, 10], 15) === 3, '[2, 5, 10], 15 should return 3.');" ], diff --git a/server/views/coursewares/showHTML.jade b/server/views/coursewares/showHTML.jade index 699355924c..7b83db4168 100644 --- a/server/views/coursewares/showHTML.jade +++ b/server/views/coursewares/showHTML.jade @@ -86,7 +86,6 @@ block content a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × .modal-body .text-center -<<<<<<< HEAD #checkmark-container.row #challenge-checkmark.animated.zoomInDown.delay-half span.completion-icon.ion-checkmark-circled.text-primary @@ -95,9 +94,4 @@ block content #submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge (ctrl + enter) else a.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge -======= - .animated.zoomInDown - span.completion-icon.ion-checkmark-circled.text-primary - a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress ->>>>>>> 45e8cef504bada71c3fa805b8e0422208299eada include ../partials/challenge-modals From 952b5e8e70402310cdccb3e73f77acd654225a09 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Mon, 14 Sep 2015 14:55:00 -0700 Subject: [PATCH 8/9] verify all basic-bonfires.json bonfires work as before --- seed/challenges/basic-bonfires.json | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 6acddd1518..860502dfc0 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -274,8 +274,8 @@ ], "tests": [ "assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, 'largestOfFour() should return an array.');", - "assert(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]) === [27,5,39,1001], '[[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]] should return [27,5,39,1001].');", - "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) === [9,35,97,1000000], '[[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]] should return [9, 35, 97, 1000000].');" + "assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27,5,39,1001], '[[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]] should return [27,5,39,1001].');", + "assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9,35,97,1000000], '[[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]] should return [9, 35, 97, 1000000].');" ], "MDNlinks": [ "Comparison Operators" @@ -426,10 +426,10 @@ "chunk([\"a\", \"b\", \"c\", \"d\"], 2, \"\");" ], "tests": [ - "assert(chunk([\"a\", \"b\", \"c\", \"d\"], 2) === [[\"a\", \"b\"], [\"c\", \"d\"]], '[\"a\", \"b\", \"c\", \"d\"], 2 should return [[\"a\", \"b\"], [\"c\", \"d\"]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 3) === [[0, 1, 2], [3, 4, 5]], '[0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 2) === [[0, 1], [2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 2 should return [[0, 1], [2, 3], [4, 5]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 4) === [[0, 1, 2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 4 should return [[0, 1, 2, 3], [4, 5]].');" + "assert.deepEqual(chunk([\"a\", \"b\", \"c\", \"d\"], 2), [[\"a\", \"b\"], [\"c\", \"d\"]], '[\"a\", \"b\", \"c\", \"d\"], 2 should return [[\"a\", \"b\"], [\"c\", \"d\"]].');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], '[0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 2 should return [[0, 1], [2, 3], [4, 5]].');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 4 should return [[0, 1, 2, 3], [4, 5]].');" ], "MDNlinks": [ "Array.push()" @@ -464,9 +464,9 @@ "slasher([1, 2, 3], 2, \"\");" ], "tests": [ - "assert(slasher([1, 2, 3], 2) === [3], '[1, 2, 3], 2, [3] should return [3].');", - "assert(slasher([1, 2, 3], 0) === [1, 2, 3], '[1, 2, 3], 0 should return [1, 2, 3].');", - "assert(slasher([1, 2, 3], 9) === [], '[1, 2, 3], 9 should return [].');" + "assert.deepEqual(slasher([1, 2, 3], 2), [3], '[1, 2, 3], 2, [3] should return [3].');", + "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], '[1, 2, 3], 0 should return [1, 2, 3].');", + "assert.deepEqual(slasher([1, 2, 3], 9), [], '[1, 2, 3], 9 should return [].');" ], "MDNlinks": [ "Array.slice()", @@ -547,9 +547,9 @@ "bouncer([7, \"ate\", \"\", false, 9], \"\");" ], "tests": [ - "assert(bouncer([7, \"ate\", \"\", false, 9]) === [7, \"ate\", 9], '[7, \"ate\", \"\", false, 9] should return [7, \"ate\", 9].');", - "assert(bouncer([\"a\", \"b\", \"c\"]) === [\"a\", \"b\", \"c\"], '[\"a\", \"b\", \"c\"] should return [\"a\", \"b\", \"c\"].');", - "assert(bouncer([false, null, 0]) === [], '[false, null, 0] should return [].');" + "assert.deepEqual(bouncer([7, \"ate\", \"\", false, 9]), [7, \"ate\", 9], '[7, \"ate\", \"\", false, 9] should return [7, \"ate\", 9].');", + "assert.deepEqual(bouncer([\"a\", \"b\", \"c\"]), [\"a\", \"b\", \"c\"], '[\"a\", \"b\", \"c\"] should return [\"a\", \"b\", \"c\"].');", + "assert.deepEqual(bouncer([false, null, 0]), [], '[false, null, 0] should return [].');" ], "MDNlinks": [ "Boolean Objects", @@ -585,11 +585,11 @@ "destroyer([1, 2, 3, 1, 2, 3], 2, 3, \"\");" ], "tests": [ - "assert(destroyer([1, 2, 3, 1, 2, 3], 2, 3) === [1, 1], '[1, 2, 3, 1, 2, 3], 2, 3 should return [1, 1].');", - "assert(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) === [1, 5, 1], '[1, 2, 3, 5, 1, 2, 3], 2, 3 should return [1, 5, 1].');", - "assert(destroyer([3, 5, 1, 2, 2], 2, 3, 5) === [1], '[3, 5, 1, 2, 2], 2, 3, 5 should return [1].');", - "assert(destroyer([2, 3, 2, 3], 2, 3) === [], '[2, 3, 2, 3], 2, 3 should return [].');", - "assert(destroyer([\"tree\", \"hamburger\", 53], \"tree\", 53) === [\"hamburger\"], '[\"tree\", \"hamburger\", 53], \"tree\", 53) should return [\"hamburger\"].');" + "assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], '[1, 2, 3, 1, 2, 3], 2, 3 should return [1, 1].');", + "assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], '[1, 2, 3, 5, 1, 2, 3], 2, 3 should return [1, 5, 1].');", + "assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], '[3, 5, 1, 2, 2], 2, 3, 5 should return [1].');", + "assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], '[2, 3, 2, 3], 2, 3 should return [].');", + "assert.deepEqual(destroyer([\"tree\", \"hamburger\", 53], \"tree\", 53), [\"hamburger\"], '[\"tree\", \"hamburger\", 53], \"tree\", 53) should return [\"hamburger\"].');" ], "MDNlinks": [ "Arguments object", From 4f16b0e996b36e5f6a676b1a2fda9d49cc501bae Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Mon, 14 Sep 2015 14:57:14 -0700 Subject: [PATCH 9/9] revert intermediate-bonfires to previous state for another camper to tackle --- seed/challenges/intermediate-bonfires.json | 160 ++++++++++----------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/seed/challenges/intermediate-bonfires.json b/seed/challenges/intermediate-bonfires.json index 32943b88a0..acbf74b77f 100644 --- a/seed/challenges/intermediate-bonfires.json +++ b/seed/challenges/intermediate-bonfires.json @@ -19,11 +19,11 @@ "sumAll([1, 4]);" ], "tests": [ - "assert(typeof(sumAll([1, 4])) === 'number', '.');", - "assert(sumAll([1, 4]) === 10, '[1, 4] should return 10.');", - "assert(sumAll([4, 1]) === 10, '[4, 1] should return 10.');", - "assert(sumAll([5, 10]) === 45, '[5, 10] should return 45.');", - "assert(sumAll([10, 5]) === 45, '[10, 5] should return 45';" + "expect(sumAll([1, 4])).to.be.a('Number');", + "expect(sumAll([1, 4])).to.equal(10);", + "expect(sumAll([4, 1])).to.equal(10);", + "expect(sumAll([5, 10])).to.equal(45);", + "expect(sumAll([10, 5])).to.equal(45);" ], "MDNlinks": [ "Math.max()", @@ -61,13 +61,13 @@ "diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);" ], "tests": [ - "assert(typeof(diff([1, 2, 3, 5], [1, 2, 3, 4, 5])) === 'array', 'diff() should return an array.');", - "assert(diff(['diorite', 'andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']) === ['pink wool'], '['diorite', 'andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub'] should return ['pink wool'].');", - "assert(diff(['andesite', 'grass', 'dirt', 'dead shrub'], ['andesite', 'grass', 'dirt', 'dead shrub']), [], 'arrays with no difference', '.');", - "assert(diff([1, 2, 3, 5], [1, 2, 3, 4, 5]) === [4], 'arrays with numbers', '.');", - "assert(diff([], ['snuffleupagus', 'cookie monster', 'elmo']), ['snuffleupagus', 'cookie monster', 'elmo'], 'empty array');", - "assert.includeMembers(diff([1, 'calf', 3, 'piglet'], [1, 'calf', 3, 4]), ['piglet', 4], 'arrays with numbers and strings', '.');", - "assert.includeMembers(diff(['andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']), ['diorite', 'pink wool'], 'arrays with more than one difference', '.');" + "expect(diff([1, 2, 3, 5], [1, 2, 3, 4, 5])).to.be.a('array');", + "assert.deepEqual(diff(['diorite', 'andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']), ['pink wool'], 'arrays with only one difference');", + "assert.includeMembers(diff(['andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']), ['diorite', 'pink wool'], 'arrays with more than one difference');", + "assert.deepEqual(diff(['andesite', 'grass', 'dirt', 'dead shrub'], ['andesite', 'grass', 'dirt', 'dead shrub']), [], 'arrays with no difference');", + "assert.deepEqual(diff([1, 2, 3, 5], [1, 2, 3, 4, 5]), [4], 'arrays with numbers');", + "assert.includeMembers(diff([1, 'calf', 3, 'piglet'], [1, 'calf', 3, 4]), ['piglet', 4], 'arrays with numbers and strings');", + "assert.deepEqual(diff([], ['snuffleupagus', 'cookie monster', 'elmo']), ['snuffleupagus', 'cookie monster', 'elmo'], 'empty array');" ], "MDNlinks": [ "Comparison Operators", @@ -93,11 +93,11 @@ "id": "a7f4d8f2483413a6ce226cac", "title": "Roman Numeral Converter", "tests": [ - "assert(convert(12) === \"XII\");", - "assert(convert(5) === \"V\");", - "assert(convert(9) === \"IX\");", - "assert(convert(29) === \"XXIX\");", - "assert(convert(16) === \"XVI\");" + "expect(convert(12)).to.equal(\"XII\");", + "expect(convert(5)).to.equal(\"V\");", + "expect(convert(9)).to.equal(\"IX\");", + "expect(convert(29)).to.equal(\"XXIX\");", + "expect(convert(16)).to.equal(\"XVI\");" ], "difficulty": "2.02", "description": [ @@ -177,11 +177,11 @@ "id": "a0b5010f579e69b815e7c5d6", "title": "Search and Replace", "tests": [ - "assert(replace(\"Let us go to the store\", \"store\", \"mall\") === \"Let us go to the mall\", '\"Let us go to the store\", \"store\", \"mall\" should return \"Let us go to the mall\", '\"Let us go to the store\", \"store\".');", - "assert(replace(\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\") === \"He is Sitting on the couch\", '\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\" should return \"He is Sitting on the couch\".');", - "assert(replace(\"This has a spellngi error\", \"spellngi\", \"spelling\") === \"This has a spelling error\", '\"This has a spellngi error\", \"spellngi\", \"spelling\" should return \"This has a spelling error\".');", - "assert(replace(\"His name is Tom\", \"Tom\", \"john\") === \"His name is John\", '\"His name is Tom\", \"Tom\", \"john\" should return \"His name is John\".');", - "assert(replace(\"Let us get back to more Coding\", \"Coding\", \"bonfires\") === \"Let us get back to more Bonfires\"), '\"Let us get back to more Coding\", \"Coding\", \"bonfires\" should return \"Let us get back to more Bonfires\"');" + "expect(replace(\"Let us go to the store\", \"store\", \"mall\")).to.equal(\"Let us go to the mall\");", + "expect(replace(\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\")).to.equal(\"He is Sitting on the couch\");", + "expect(replace(\"This has a spellngi error\", \"spellngi\", \"spelling\")).to.equal(\"This has a spelling error\");", + "expect(replace(\"His name is Tom\", \"Tom\", \"john\")).to.equal(\"His name is John\");", + "expect(replace(\"Let us get back to more Coding\", \"Coding\", \"bonfires\")).to.equal(\"Let us get back to more Bonfires\");" ], "difficulty": "2.035", "description": [ @@ -221,11 +221,11 @@ "id": "aa7697ea2477d1316795783b", "title": "Pig Latin", "tests": [ - "assert(translate(\"california\") === \"aliforniacay\", '\"california\" should return \"aliforniacay\".');", - "assert(translate(\"paragraphs\") === \"aragraphspay\", '\"paragraphs\" should return \"aragraphspay\".');", - "assert(translate(\"glove\") === \"oveglay\", '\"glove\" should return \"oveglay\".');", - "assert(translate(\"algorithm\") === \"algorithmway\", '\"algorithm\" should return \"algorithmway\".');", - "assert(translate(\"eight\") === \"eightway\"), '\"eight\" should return \"eightway\".');" + "expect(translate(\"california\")).to.equal(\"aliforniacay\");", + "expect(translate(\"paragraphs\")).to.equal(\"aragraphspay\");", + "expect(translate(\"glove\")).to.equal(\"oveglay\");", + "expect(translate(\"algorithm\")).to.equal(\"algorithmway\");", + "expect(translate(\"eight\")).to.equal(\"eightway\");" ], "difficulty": "2.04", "description": [ @@ -265,9 +265,9 @@ "id": "afd15382cdfb22c9efe8b7de", "title": "DNA Pairing", "tests": [ - "assert(pair(\"ATCGA\") === [['A','T'],['T','A'],['C','G'],['G','C'],['A','T']], '\"ATCGA\" should return [['A','T'],['T','A'],['C','G'],['G','C'],['A','T']].');", - "assert(pair(\"TTGAG\") === [['T','A'],['T','A'],['G','C'],['A','T'],['G','C']], '\"TTGAG\" should return [['T','A'],['T','A'],['G','C'],['A','T'],['G','C']].');", - "assert(pair(\"CTCTA\") === [['C','G'],['T','A'],['C','G'],['T','A'],['A','T']], '\"CTCTA\" should return [['C','G'],['T','A'],['C','G'],['T','A'],['A','T']].');" + "assert.deepEqual(pair(\"ATCGA\"),[['A','T'],['T','A'],['C','G'],['G','C'],['A','T']], 'should return the dna pair');", + "assert.deepEqual(pair(\"TTGAG\"),[['T','A'],['T','A'],['G','C'],['A','T'],['G','C']], 'should return the dna pair');", + "assert.deepEqual(pair(\"CTCTA\"),[['C','G'],['T','A'],['C','G'],['T','A'],['A','T']], 'should return the dna pair');" ], "difficulty": "2.05", "description": [ @@ -319,10 +319,10 @@ "fearNotLetter('abce');" ], "tests": [ - "assert(fearNotLetter('abce') === 'd', '.');", - "assert(fearNotLetter('bcd')) === undefined, '.');", - "assert(fearNotLetter('abcdefghjklmno') === 'i', '.');", - "assert(fearNotLetter('yz')) === undefined, '.');" + "expect(fearNotLetter('abce')).to.equal('d');", + "expect(fearNotLetter('bcd')).to.be.undefined;", + "expect(fearNotLetter('abcdefghjklmno')).to.equal('i');", + "expect(fearNotLetter('yz')).to.be.undefined;" ], "MDNlinks": [ "String.charCodeAt()", @@ -359,13 +359,13 @@ "boo(null);" ], "tests": [ - "assert.strictEqual(boo(true), true, '.');", - "assert.strictEqual(boo(false), true, '.');", - "assert.strictEqual(boo([1, 2, 3]), false, '.');", - "assert.strictEqual(boo([].slice), false, '.');", - "assert.strictEqual(boo({ 'a': 1 }), false, '.');", - "assert.strictEqual(boo(1), false, '.');", - "assert.strictEqual(boo(NaN), false, '.');", + "assert.strictEqual(boo(true), true);", + "assert.strictEqual(boo(false), true);", + "assert.strictEqual(boo([1, 2, 3]), false);", + "assert.strictEqual(boo([].slice), false);", + "assert.strictEqual(boo({ 'a': 1 }), false);", + "assert.strictEqual(boo(1), false);", + "assert.strictEqual(boo(NaN), false);", "assert.strictEqual(boo('a'), false);" ], "MDNlinks": [ @@ -403,9 +403,9 @@ "unite([1, 3, 2], [5, 2, 1, 4], [2, 1]);" ], "tests": [ - "assert.deepEqual(unite([1, 3, 2], [5, 2, 1, 4], [2, 1]), [1, 3, 2, 5, 4], 'should return the union of the given arrays', '.');", - "assert.deepEqual(unite([1, 3, 2], [1, [5]], [2, [4]]), [1, 3, 2, [5], [4]], 'should not flatten nested arrays', '.');", - "assert.deepEqual(unite([1, 2, 3], [5, 2, 1]), [1, 2, 3, 5], 'should correctly handle exactly two arguments', '.');", + "assert.deepEqual(unite([1, 3, 2], [5, 2, 1, 4], [2, 1]), [1, 3, 2, 5, 4], 'should return the union of the given arrays');", + "assert.deepEqual(unite([1, 3, 2], [1, [5]], [2, [4]]), [1, 3, 2, [5], [4]], 'should not flatten nested arrays');", + "assert.deepEqual(unite([1, 2, 3], [5, 2, 1]), [1, 2, 3, 5], 'should correctly handle exactly two arguments');", "assert.deepEqual(unite([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]), [ 1, 2, 3, 5, 4, 6, 7, 8 ], 'should correctly handle higher numbers of arguments');" ], "MDNlinks": [ @@ -442,12 +442,12 @@ "convert('Dolce & Gabbana');" ], "tests": [ - "assert.match(convert('Dolce & Gabbana'), /Dolce &(amp|AMP|#x00026|#38); Gabbana/, 'should escape characters', '.');", - "assert.match(convert('Hamburgers < Pizza < Tacos'), /Hamburgers &(lt|LT|#x0003C|#60); Pizza &(lt|LT|#x0003C|#60); Tacos/, 'should escape characters', '.');", - "assert.match(convert('Sixty > twelve'), /Sixty &(gt|GT|#x0003E|#62); twelve/, 'should escape characters', '.');", - "assert.match(convert('Stuff in \"quotation marks\"'), /Stuff in &(quot|QUOT|#x00022|#34);quotation marks&(quot|QUOT|#x00022|#34);/, 'should escape characters', '.');", - "assert.match(convert(\"Shindler's List\"), /Shindler&(apos|#x00027|#39);s List/, 'should escape characters', '.');", - "assert.match(convert('<>'), /&(lt|LT|#x0003C|#60);&(gt|GT|#x0003E|#62);/, 'should escape characters', '.');", + "assert.match(convert('Dolce & Gabbana'), /Dolce &(amp|AMP|#x00026|#38); Gabbana/, 'should escape characters');", + "assert.match(convert('Hamburgers < Pizza < Tacos'), /Hamburgers &(lt|LT|#x0003C|#60); Pizza &(lt|LT|#x0003C|#60); Tacos/, 'should escape characters');", + "assert.match(convert('Sixty > twelve'), /Sixty &(gt|GT|#x0003E|#62); twelve/, 'should escape characters');", + "assert.match(convert('Stuff in \"quotation marks\"'), /Stuff in &(quot|QUOT|#x00022|#34);quotation marks&(quot|QUOT|#x00022|#34);/, 'should escape characters');", + "assert.match(convert(\"Shindler's List\"), /Shindler&(apos|#x00027|#39);s List/, 'should escape characters');", + "assert.match(convert('<>'), /&(lt|LT|#x0003C|#60);&(gt|GT|#x0003E|#62);/, 'should escape characters');", "assert.strictEqual(convert('abc'), 'abc', 'should handle strings with nothing to escape');" ], "MDNlinks": [ @@ -485,9 +485,9 @@ "spinalCase('This Is Spinal Tap');" ], "tests": [ - "assert.strictEqual(spinalCase('This Is Spinal Tap'), 'this-is-spinal-tap', 'should return spinal case from string with spaces', '.');", - "assert.strictEqual(spinalCase('thisIsSpinalTap'), 'this-is-spinal-tap', 'should return spinal case from string with camel case', '.');", - "assert.strictEqual(spinalCase('The_Andy_Griffith_Show'), 'the-andy-griffith-show', 'should return spinal case from string with snake case', '.');", + "assert.strictEqual(spinalCase('This Is Spinal Tap'), 'this-is-spinal-tap', 'should return spinal case from string with spaces');", + "assert.strictEqual(spinalCase('thisIsSpinalTap'), 'this-is-spinal-tap', 'should return spinal case from string with camel case');", + "assert.strictEqual(spinalCase('The_Andy_Griffith_Show'), 'the-andy-griffith-show', 'should return spinal case from string with snake case');", "assert.strictEqual(spinalCase('Teletubbies say Eh-oh'), 'teletubbies-say-eh-oh', 'should return spinal case from string with spaces and hyphens');" ], "MDNlinks": [ @@ -525,12 +525,12 @@ "sumFibs(4);" ], "tests": [ - "assert(sumFibs(1)).to.be.a('number', '.');", - "assert(sumFibs(1000) === 1785, '.');", - "assert(sumFibs(4000000) === 4613732, '.');", - "assert(sumFibs(4) === 5, '.');", - "assert(sumFibs(75024) === 60696, '.');", - "assert(sumFibs(75025) === 135721);" + "expect(sumFibs(1)).to.be.a('number');", + "expect(sumFibs(1000)).to.equal(1785);", + "expect(sumFibs(4000000)).to.equal(4613732);", + "expect(sumFibs(4)).to.equal(5);", + "expect(sumFibs(75024)).to.equal(60696);", + "expect(sumFibs(75025)).to.equal(135721);" ], "MDNlinks": [ "Remainder" @@ -566,9 +566,9 @@ "sumPrimes(10);" ], "tests": [ - "assert(sumPrimes(10)).to.be.a('number', '.');", - "assert(sumPrimes(10) === 17, '.');", - "assert(sumPrimes(977) === 73156);" + "expect(sumPrimes(10)).to.be.a('number');", + "expect(sumPrimes(10)).to.equal(17);", + "expect(sumPrimes(977)).to.equal(73156);" ], "MDNlinks": [ "For Loops", @@ -594,7 +594,7 @@ "description": [ "Find the smallest common multiple of the provided parameters that can be evenly divided by both, as well as by all sequential numbers in the range between these parameters.", "The range will be an array of two numbers that will not necessarily be in numerical order.", - "e.g. for 1 and 3 - find the smallest common multiple of both 1 and 3 that is evenly divisible by all numbers between 1 and 3.", + "e.g. for 1 and 3 - find the smallest common multiple of both 1 and 3 that is evenly divisible by all numbers between 1 and 3.", "Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code." ], "challengeSeed": [ @@ -606,10 +606,10 @@ "smallestCommons([1,5]);" ], "tests": [ - "assert(smallestCommons([1,5])).to.be.a('number', '.');", - "assert(smallestCommons([1,5]) === 60, '.');", - "assert(smallestCommons([5,1]) === 60, '.');", - "assert(smallestCommons([1,13]) === 360360);" + "expect(smallestCommons([1,5])).to.be.a('number');", + "expect(smallestCommons([1,5])).to.equal(60);", + "expect(smallestCommons([5,1])).to.equal(60);", + "expect(smallestCommons([1,13])).to.equal(360360);" ], "MDNlinks": [ "Smallest Common Multiple" @@ -644,7 +644,7 @@ "find([1, 2, 3, 4], function(num){ return num % 2 === 0; });" ], "tests": [ - "assert.strictEqual(find([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, 'should return first found value', '.');", + "assert.strictEqual(find([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, 'should return first found value');", "assert.strictEqual(find([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, 'should return undefined if not found');" ], "MDNlinks": [ @@ -719,9 +719,9 @@ "steamroller([1, [2], [3, [[4]]]]);" ], "tests": [ - "assert.deepEqual(steamroller([[['a']], [['b']]]), ['a', 'b'], 'should flatten nested arrays', '.');", - "assert.deepEqual(steamroller([1, [2], [3, [[4]]]]), [1, 2, 3, 4], 'should flatten nested arrays', '.');", - "assert.deepEqual(steamroller([1, [], [3, [[4]]]]), [1, 3, 4], 'should work with empty arrays', '.');", + "assert.deepEqual(steamroller([[['a']], [['b']]]), ['a', 'b'], 'should flatten nested arrays');", + "assert.deepEqual(steamroller([1, [2], [3, [[4]]]]), [1, 2, 3, 4], 'should flatten nested arrays');", + "assert.deepEqual(steamroller([1, [], [3, [[4]]]]), [1, 3, 4], 'should work with empty arrays');", "assert.deepEqual(steamroller([1, {}, [3, [[4]]]]), [1, {}, 3, 4], 'should work with actual objects');" ], "MDNlinks": [ @@ -757,8 +757,8 @@ "binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111');" ], "tests": [ - "assert(binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111') === \"Aren't bonfires fun!?\", '.');", - "assert(binaryAgent('01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000110 01110010 01100101 01100101 01000011 01101111 01100100 01100101 01000011 01100001 01101101 01110000 00100001') === \"I love FreeCodeCamp!\");" + "expect(binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111')).to.equal(\"Aren't bonfires fun!?\");", + "expect(binaryAgent('01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000110 01110010 01100101 01100101 01000011 01101111 01100100 01100101 01000011 01100001 01101101 01110000 00100001')).to.equal(\"I love FreeCodeCamp!\");" ], "MDNlinks": [ "String.charCodeAt()", @@ -796,8 +796,8 @@ "every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex');" ], "tests": [ - "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex'), true, 'should return true if predicate returns truthy for all elements in the collection', '.');", - "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], {'sex': 'female'}), false, 'should return false if predicate returns falsey for any element in the collection', '.');", + "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex'), true, 'should return true if predicate returns truthy for all elements in the collection');", + "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], {'sex': 'female'}), false, 'should return false if predicate returns falsey for any element in the collection');", "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'female'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], {'sex': 'female'}), false, 'should return false if predicate returns falsey for any element in the collection');" ], "MDNlinks": [ @@ -835,11 +835,11 @@ "add(2,3);" ], "tests": [ - "assert(add(2, 3) === 5, '.');", - "assert(add(2)(3) === 5, '.');", - "assert(add('http://bit.ly/IqT6zt')).to.be.undefined;", - "assert(add(2, '3')).to.be.undefined;", - "assert(add(2)([3])).to.be.undefined;" + "expect(add(2, 3)).to.equal(5);", + "expect(add(2)(3)).to.equal(5);", + "expect(add('http://bit.ly/IqT6zt')).to.be.undefined;", + "expect(add(2, '3')).to.be.undefined;", + "expect(add(2)([3])).to.be.undefined;" ], "MDNlinks": [ "Global Function Object",