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."
],
"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\", '<code>reverseString&#40;&#41;</code> 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&#40;&#41; 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 <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": [
"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,