start refactoring bonfire tests

pull/3304/head
Quincy Larson 2015-08-23 13:10:30 -07:00
parent 9fc3fd72b1
commit 59bb244286
1 changed files with 86 additions and 86 deletions

View File

@ -13,8 +13,8 @@
"Make this function return true no matter what." "Make this function return true no matter what."
], ],
"tests": [ "tests": [
"expect(meetBonfire()).to.be.a(\"boolean\");", "assert(typeof(meetBonfire()) === \"boolean\", 'The result should be a Boolean value of true or false.');",
"expect(meetBonfire()).to.be.true;" "assert(meetBonfire() === true, 'Your meetBonfire() function should return true.');"
], ],
"challengeSeed": [ "challengeSeed": [
"function meetBonfire(argument) {", "function meetBonfire(argument) {",
@ -46,10 +46,10 @@
"title": "Reverse a String", "title": "Reverse a String",
"difficulty": "1.01", "difficulty": "1.01",
"tests": [ "tests": [
"expect(reverseString('hello')).to.be.a('String');", "assert(typeof(reverseString('hello')) === \"string\", '<code>reverseString&#40;&#41;</code> should return a string.');",
"expect(reverseString('hello')).to.equal('olleh');", "assert(reverseString('hello') === 'olleh', '\"hello\" should become \"olleh\".');",
"expect(reverseString('Howdy')).to.equal('ydwoH');", "assert(reverseString('Howdy') === 'ydwoH', '\"Howdy\" should become \"ydwoH\".');",
"expect(reverseString('Greetings from Earth')).to.equal('htraE morf sgniteerG');" "assert(reverseString('Greetings from Earth') === 'htraE morf sgniteerG', '\"Greetings from Earth\" should return \"htraE morf sgniteerG\".');"
], ],
"description": [ "description": [
"Reverse the provided string.", "Reverse the provided string.",
@ -62,7 +62,7 @@
" return str;", " return str;",
"}", "}",
"", "",
"reverseString('hello');" "reverseString('hello', '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Global String Object", "Global String Object",
@ -87,10 +87,10 @@
"id": "a302f7aae1aa3152a5b413bc", "id": "a302f7aae1aa3152a5b413bc",
"title": "Factorialize a Number", "title": "Factorialize a Number",
"tests": [ "tests": [
"expect(factorialize(5)).to.be.a(\"Number\");", "assert(typeof(factorialize(5)) === \"number\", 'factorialize&#40;&#41; should return a number.');",
"expect(factorialize(5)).to.equal(120);", "assert(factorialize(5) === 120, '5 should return 120.');",
"expect(factorialize(10)).to.equal(3628800);", "assert(factorialize(10) === 3628800, '10 should return 3,628,800.');",
"expect(factorialize(20)).to.equal(2432902008176640000);" "assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');"
], ],
"difficulty": "1.02", "difficulty": "1.02",
"description": [ "description": [
@ -105,7 +105,7 @@
" return num;", " return num;",
"}", "}",
"", "",
"factorialize(5);" "factorialize(5, '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Arithmetic Operators" "Arithmetic Operators"
@ -135,14 +135,14 @@
"Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>Read-Search-Ask</a> if you get stuck. Write your own code." "Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>Read-Search-Ask</a> if you get stuck. Write your own code."
], ],
"tests": [ "tests": [
"expect(palindrome(\"eye\")).to.be.a(\"boolean\");", "assert(palindrome(\"eye\")) === \"boolean\", '');",
"assert.deepEqual(palindrome(\"eye\"), true);", "assert.deepEqual(palindrome(\"eye\"), true, '');",
"assert.deepEqual(palindrome(\"race car\"), true);", "assert.deepEqual(palindrome(\"race car\"), true, '');",
"assert.deepEqual(palindrome(\"not a palindrome\"), false);", "assert.deepEqual(palindrome(\"not a palindrome\"), false, '');",
"assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true);", "assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true, '');",
"assert.deepEqual(palindrome(\"never odd or even\"), true);", "assert.deepEqual(palindrome(\"never odd or even\"), true, '');",
"assert.deepEqual(palindrome(\"nope\"), false);", "assert.deepEqual(palindrome(\"nope\"), false, '');",
"assert.deepEqual(palindrome(\"almostomla\"), false);" "assert.deepEqual(palindrome(\"almostomla\"), false, '');"
], ],
"challengeSeed": [ "challengeSeed": [
"function palindrome(str) {", "function palindrome(str) {",
@ -152,7 +152,7 @@
"", "",
"", "",
"", "",
"palindrome(\"eye\");" "palindrome(\"eye\", '');"
], ],
"MDNlinks": [ "MDNlinks": [
"String.replace()", "String.replace()",
@ -185,15 +185,15 @@
" return str.length;", " return str.length;",
"}", "}",
"", "",
"findLongestWord('The quick brown fox jumped over the lazy dog');" "findLongestWord('The quick brown fox jumped over the lazy dog', '');"
], ],
"tests": [ "tests": [
"expect(findLongestWord('The quick brown fox jumped over the lazy dog')).to.be.a('Number');", "assert(findLongestWord('The quick brown fox jumped over the lazy dog')) === 'Number', '');",
"expect(findLongestWord('The quick brown fox jumped over the lazy dog')).to.equal(6);", "assert(findLongestWord('The quick brown fox jumped over the lazy dog') === 6, '');",
"expect(findLongestWord('May the force be with you')).to.equal(5);", "assert(findLongestWord('May the force be with you') === 5, '');",
"expect(findLongestWord('Google do a barrel roll')).to.equal(6);", "assert(findLongestWord('Google do a barrel roll') === 6, '');",
"expect(findLongestWord('What is the average airspeed velocity of an unladen swallow')).to.equal(8);", "assert(findLongestWord('What is the average airspeed velocity of an unladen swallow') === 8, '');",
"expect(findLongestWord('What if we try a super-long word such as otorhinolaryngology')).to.equal(19);" "assert(findLongestWord('What if we try a super-long word such as otorhinolaryngology') === 19, '');"
], ],
"MDNlinks": [ "MDNlinks": [
"String.split()", "String.split()",
@ -226,13 +226,13 @@
" return str;", " return str;",
"}", "}",
"", "",
"titleCase(\"I'm a little tea pot\");" "titleCase(\"I'm a little tea pot\", '');"
], ],
"tests": [ "tests": [
"expect(titleCase(\"I'm a little tea pot\")).to.be.a('String');", "assert(titleCase(\"I'm a little tea pot\")) === 'String', '');",
"expect(titleCase(\"I'm a little tea pot\")).to.equal(\"I'm A Little Tea Pot\");", "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '');",
"expect(titleCase(\"sHoRt AnD sToUt\")).to.equal(\"Short And Stout\");", "assert(titleCase(\"sHoRt AnD sToUt\") === \"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(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '');"
], ],
"MDNlinks": [ "MDNlinks": [
"String.charAt()" "String.charAt()"
@ -266,12 +266,12 @@
" return arr;", " 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": [ "tests": [
"expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');", "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]);", "(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, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]), '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Comparison Operators" "Comparison Operators"
@ -304,14 +304,14 @@
" return str;", " return str;",
"}", "}",
"", "",
"end('Bastian', 'n');" "end('Bastian', 'n', '');"
], ],
"tests": [ "tests": [
"assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals 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('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('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('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('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": [ "MDNlinks": [
"String.substr()" "String.substr()"
@ -343,12 +343,12 @@
" return str;", " return str;",
"}", "}",
"", "",
"repeat('abc', 3);" "repeat('abc', 3, '');"
], ],
"tests": [ "tests": [
"assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times');", "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', 3), 'abcabcabc', 'should repeat a string n times', '');",
"assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers');" "assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers', '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Global String Object" "Global String Object"
@ -381,13 +381,13 @@
" return str;", " 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": [ "tests": [
"expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');", "assert(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('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(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.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": [ "MDNlinks": [
"String.slice()" "String.slice()"
@ -419,13 +419,13 @@
" return arr;", " return arr;",
"}", "}",
"", "",
"chunk(['a', 'b', 'c', 'd'], 2);" "chunk(['a', 'b', 'c', 'd'], 2, '');"
], ],
"tests": [ "tests": [
"assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');", "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], 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], 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([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements', '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Array.push()" "Array.push()"
@ -457,12 +457,12 @@
" return arr;", " return arr;",
"}", "}",
"", "",
"slasher([1, 2, 3], 2);" "slasher([1, 2, 3], 2, '');"
], ],
"tests": [ "tests": [
"assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements');", "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], 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], 9), [], 'should return an empty array', '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Array.slice()", "Array.slice()",
@ -497,17 +497,17 @@
" return arr;", " return arr;",
"}", "}",
"", "",
"mutation(['hello', 'hey']);" "mutation(['hello', 'hey'], '');"
], ],
"tests": [ "tests": [
"expect(mutation(['hello', 'hey'])).to.be.false;", "assert(mutation(['hello', 'hey'])).to.be.false;",
"expect(mutation(['hello', 'Hello'])).to.be.true;", "assert(mutation(['hello', 'Hello'])).to.be.true;",
"expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;", "assert(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;",
"expect(mutation(['Mary', 'Army'])).to.be.true;", "assert(mutation(['Mary', 'Army'])).to.be.true;",
"expect(mutation(['Mary', 'Aarmy'])).to.be.true;", "assert(mutation(['Mary', 'Aarmy'])).to.be.true;",
"expect(mutation(['Alien', 'line'])).to.be.true;", "assert(mutation(['Alien', 'line'])).to.be.true;",
"expect(mutation(['floor', 'for'])).to.be.true;", "assert(mutation(['floor', 'for'])).to.be.true;",
"expect(mutation(['hello', 'neo'])).to.be.false;" "assert(mutation(['hello', 'neo'])).to.be.false;"
], ],
"MDNlinks": [ "MDNlinks": [
"Array.indexOf()" "Array.indexOf()"
@ -540,12 +540,12 @@
" return arr;", " return arr;",
"}", "}",
"", "",
"bouncer([7, 'ate', '', false, 9]);" "bouncer([7, 'ate', '', false, 9], '');"
], ],
"tests": [ "tests": [
"assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values');", "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(['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([false, null, 0]), [], 'should return empty array if all elements are falsey', '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Boolean Objects", "Boolean Objects",
@ -579,11 +579,11 @@
" return arr;", " 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": [ "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([{ 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([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples', '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Global Object", "Global Object",
@ -617,14 +617,14 @@
" return arr;", " return arr;",
"}", "}",
"", "",
"destroyer([1, 2, 3, 1, 2, 3], 2, 3);" "destroyer([1, 2, 3, 1, 2, 3], 2, 3, '');"
], ],
"tests": [ "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, 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([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([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([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(['tree', 'hamburger', 53], 'tree', 53), ['hamburger'], 'should handle NaN-elements', '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Arguments object", "Arguments object",
@ -658,14 +658,14 @@
" return num;", " return num;",
"}", "}",
"", "",
"where([40, 60], 50);" "where([40, 60], 50, '');"
], ],
"MDNlinks": [ "MDNlinks": [
"Array.sort()" "Array.sort()"
], ],
"tests": [ "tests": [
"expect(where([10, 20, 30, 40, 50], 35)).to.equal(3);", "assert(where([10, 20, 30, 40, 50], 35) === 3, '');",
"expect(where([10, 20, 30, 40, 50], 30)).to.equal(2);" "assert(where([10, 20, 30, 40, 50], 30) === 2, '');"
], ],
"type": "bonfire", "type": "bonfire",
"challengeType": 5, "challengeType": 5,