From 8e705b14ecd649f62eae6d862bf97b3f2783efcd Mon Sep 17 00:00:00 2001 From: Ionut Costica Date: Wed, 19 Aug 2015 15:43:39 +0300 Subject: [PATCH 001/189] Fix for Issue #2179, #2141, #2077, #1999 Fixes #2179, #2141, #2077, #1999 --- seed/challenges/basic-javascript.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 1096e02868..de249f003a 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -16,9 +16,9 @@ "Try creating one of each." ], "tests":[ - "assert(editor.getValue().match(/(\\/\\/)...../g), 'Create a \\/\\/ style comment that contains at least five letters');", - "assert(editor.getValue().match(/(\\/\\*)...../g), 'Create a \/\\* \\*\/ style comment that contains at least five letters.');", - "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the comment with a \\*\/');" + "assert(editor.getValue().match(/(\\/\\/)...../g), 'Create a // style comment that contains at least five letters');", + "assert(editor.getValue().match(/(\\/\\*)[\\w\\W]{5,}(?=\\*\\/)/gm), 'Create a /* */ style comment that contains at least five letters.');", + "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the comment with a */');" ], "challengeSeed":[ ], From 59bb244286dd514748ba22b6277969e709fdc0c0 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 23 Aug 2015 13:10:30 -0700 Subject: [PATCH 002/189] 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 003/189] 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 004/189] 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 fbbbff2186299817b965e362dbc0a241f02692f7 Mon Sep 17 00:00:00 2001 From: Aryan Jabbari Date: Mon, 24 Aug 2015 23:11:21 -0400 Subject: [PATCH 005/189] Changed 'Show the Local Weather' wording to fix #2623 --- seed/challenges/basic-ziplines.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/basic-ziplines.json b/seed/challenges/basic-ziplines.json index 37e547c4e3..c1a6ec00f9 100644 --- a/seed/challenges/basic-ziplines.json +++ b/seed/challenges/basic-ziplines.json @@ -115,8 +115,8 @@ "Rule #3: Reverse engineer the example project's functionality, and also feel free to personalize it.", "Here are the user stories you must enable, and optional bonus user stories:", "User Story: As a user, I can see the weather in my current location.", - "Bonus User Story: As a user, I can see an icon depending on the temperature..", - "Bonus User Story: As a user, I see a different background image depending on the temperature (e.g. snowy mountain, hot desert).", + "Bonus User Story: As a user, I can see an icon depending on the weather.", + "Bonus User Story: As a user, I see a different background image (e.g. snowy mountain, hot desert) depending on the weather.", "Bonus User Story: As a user, I can push a button to toggle between Fahrenheit and Celsius.", "Remember to use Read-Search-Ask if you get stuck.", "When you are finished, click the \"I've completed this challenge\" button and include a link to your CodePen. If you pair programmed, you should also include the Free Code Camp username of your pair.", From 547fa9424f5faeed2647d64d452a564de20b1a6e Mon Sep 17 00:00:00 2001 From: sJhonny-e Date: Tue, 25 Aug 2015 18:12:17 +0300 Subject: [PATCH 006/189] changed regex for checking style element in challenge "Use CSS Selectors to Style Elements"; regex now allows opening style elements to have whitespace before closing '>', and also the allowed attributes (type, media etc..) --- seed/challenges/html5-and-css.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index b93a1de494..b81dbd4356 100644 --- a/seed/challenges/html5-and-css.json +++ b/seed/challenges/html5-and-css.json @@ -383,7 +383,7 @@ "assert(!$(\"h2\").attr(\"style\"), 'Remove the style attribute from your h2 element.')", "assert($(\"style\") && $(\"style\").length > 1, 'Create a style element.')", "assert($(\"h2\").css(\"color\") === \"rgb(0, 0, 255)\", 'Your h2 element should be blue.')", - "assert(editor.match(/<\\/style>/g) && editor.match(/<\\/style>/g).length === editor.match(/