fix(curriculum): quotes in tests (#18828)

* fix(curriculum): tests quotes

* fix(curriculum): fill seed-teardown

* fix(curriculum): fix tests and remove unneeded seed-teardown
This commit is contained in:
Valeriy
2018-10-20 21:02:47 +03:00
committed by mrugesh mohapatra
parent 96eb124163
commit 79d9012432
1339 changed files with 6499 additions and 5185 deletions

View File

@ -28,8 +28,8 @@ For the cat with the "id" of 2, print to the console the second value in the <co
```yml
tests:
- text: 'Your code should use bracket and dot notation to access the proper code name, and print "Loki" to the console.'
testString: 'assert(code.match(/(?:json\[2\]\.codeNames\[1\]|json\[2\]\[("|")codeNames\1\]\[1\])/g), "Your code should use bracket and dot notation to access the proper code name, and print "Loki" to the console.");'
- text: Your code should use bracket and dot notation to access the proper code name, and print "Loki" to the console.
testString: assert(code.match(/(?:json\[2\]\.codeNames\[1\]|json\[2\]\[('|")codeNames\1\]\[1\])/g), 'Your code should use bracket and dot notation to access the proper code name, and print "Loki" to the console.');
```

View File

@ -23,7 +23,7 @@ Add code inside the <code>onclick</code> event handler to change the text inside
```yml
tests:
- text: Your code should use the <code>document.getElementsByClassName</code> method to select the element with class <code>message</code> and set its <code>textContent</code> to the given string.
testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.textContent\s*?=\s*?("|")Here is the message\2/g), "Your code should use the <code>document.getElementsByClassName</code> method to select the element with class <code>message</code> and set its <code>textContent</code> to the given string.");'
testString: assert(code.match(/document\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\.textContent\s*?=\s*?('|")Here is the message\2/g), 'Your code should use the <code>document.getElementsByClassName</code> method to select the element with class <code>message</code> and set its <code>textContent</code> to the given string.');
```

View File

@ -27,11 +27,11 @@ Here is some example JSON
```yml
tests:
- text: Your code should store the data in the <code>html</code> variable
testString: 'assert(code.match(/html\s+?(\+=|=\shtml\s\+)/g), "Your code should store the data in the <code>html</code> variable");'
testString: assert(code.match(/html\s+?(\+=|=\shtml\s\+)/g), 'Your code should store the data in the <code>html</code> variable');
- text: Your code should use a <code>forEach</code> method to loop over the JSON data from the API.
testString: 'assert(code.match(/json\.forEach/g), "Your code should use a <code>forEach</code> method to loop over the JSON data from the API.");'
testString: assert(code.match(/json\.forEach/g), 'Your code should use a <code>forEach</code> method to loop over the JSON data from the API.');
- text: Your code should wrap the key names in <code>strong</code> tags.
testString: 'assert(code.match(/<strong>.+<\/strong>/g), "Your code should wrap the key names in <code>strong</code> tags.");'
testString: assert(code.match(/<strong>.+<\/strong>/g), 'Your code should wrap the key names in <code>strong</code> tags.');
```

View File

@ -25,14 +25,14 @@ Add the example code inside the <code>script</code> tags to check a user's curre
```yml
tests:
- text: 'Your code should use <code>navigator.geolocation</code> to access the user&#39;s current location.'
testString: 'assert(code.match(/navigator\.geolocation\.getCurrentPosition/g), "Your code should use <code>navigator.geolocation</code> to access the user&#39;s current location.");'
- text: 'Your code should use <code>position.coords.latitude</code> to display the user&#39;s latitudinal location.'
testString: 'assert(code.match(/position\.coords\.latitude/g), "Your code should use <code>position.coords.latitude</code> to display the user&#39;s latitudinal location.");'
- text: 'Your code should use <code>position.coords.longitude</code> to display the user&#39;s longitudinal location.'
testString: 'assert(code.match(/position\.coords\.longitude/g), "Your code should use <code>position.coords.longitude</code> to display the user&#39;s longitudinal location.");'
- text: 'You should display the user&#39;s position within the <code>data</code> div element.'
testString: 'assert(code.match(/document\.getElementById\(\s*?("|")data\1\s*?\)\.innerHTML/g), "You should display the user&#39;s position within the <code>data</code> div element.");'
- text: Your code should use <code>navigator.geolocation</code> to access the user&#39;s current location.
testString: assert(code.match(/navigator\.geolocation\.getCurrentPosition/g), 'Your code should use <code>navigator.geolocation</code> to access the user&#39;s current location.');
- text: Your code should use <code>position.coords.latitude</code> to display the user&#39;s latitudinal location.
testString: assert(code.match(/position\.coords\.latitude/g), 'Your code should use <code>position.coords.latitude</code> to display the user&#39;s latitudinal location.');
- text: Your code should use <code>position.coords.longitude</code> to display the user&#39;s longitudinal location.
testString: assert(code.match(/position\.coords\.longitude/g), 'Your code should use <code>position.coords.longitude</code> to display the user&#39;s longitudinal location.');
- text: You should display the user&#39;s position within the <code>data</code> div element.
testString: assert(code.match(/document\.getElementById\(\s*?('|")data\1\s*?\)\.innerHTML/g), 'You should display the user&#39;s position within the <code>data</code> div element.');
```

View File

@ -30,17 +30,17 @@ Update the code to create and send a "GET" request to the freeCodeCamp Cat Photo
```yml
tests:
- text: Your code should create a new <code>XMLHttpRequest</code>.
testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), "Your code should create a new <code>XMLHttpRequest</code>.");'
testString: assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), 'Your code should create a new <code>XMLHttpRequest</code>.');
- text: Your code should use the <code>open</code> method to initialize a "GET" request to the freeCodeCamp Cat Photo API.
testString: 'assert(code.match(/\.open\(\s*?("|")GET\1\s*?,\s*?("|")\/json\/cats\.json\2\s*?,\s*?true\s*?\)/g), "Your code should use the <code>open</code> method to initialize a "GET" request to the freeCodeCamp Cat Photo API.");'
testString: assert(code.match(/\.open\(\s*?('|")GET\1\s*?,\s*?('|")\/json\/cats\.json\2\s*?,\s*?true\s*?\)/g), 'Your code should use the <code>open</code> method to initialize a "GET" request to the freeCodeCamp Cat Photo API.');
- text: Your code should use the <code>send</code> method to send the request.
testString: 'assert(code.match(/\.send\(\s*\)/g), "Your code should use the <code>send</code> method to send the request.");'
testString: assert(code.match(/\.send\(\s*\)/g), 'Your code should use the <code>send</code> method to send the request.');
- text: Your code should have an <code>onload</code> event handler set to a function.
testString: 'assert(code.match(/\.onload\s*=\s*function\(\s*?\)\s*?{/g), "Your code should have an <code>onload</code> event handler set to a function.");'
testString: assert(code.match(/\.onload\s*=\s*function\(\s*?\)\s*?{/g), 'Your code should have an <code>onload</code> event handler set to a function.');
- text: Your code should use the <code>JSON.parse</code> method to parse the <code>responseText</code>.
testString: 'assert(code.match(/JSON\.parse\(.*\.responseText\)/g), "Your code should use the <code>JSON.parse</code> method to parse the <code>responseText</code>.");'
testString: assert(code.match(/JSON\.parse\(.*\.responseText\)/g), 'Your code should use the <code>JSON.parse</code> method to parse the <code>responseText</code>.');
- text: Your code should get the element with class <code>message</code> and change its inner HTML to the string of JSON data.
testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?JSON\.stringify\(.+?\)/g), "Your code should get the element with class <code>message</code> and change its inner HTML to the string of JSON data.");'
testString: assert(code.match(/document\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?JSON\.stringify\(.+?\)/g), 'Your code should get the element with class <code>message</code> and change its inner HTML to the string of JSON data.');
```

View File

@ -23,9 +23,9 @@ Add a click event handler inside of the <code>DOMContentLoaded</code> function f
```yml
tests:
- text: Your code should use the <code>document.getElementById</code> method to select the <code>getMessage</code> element.
testString: 'assert(code.match(/document\.getElementById\(\s*?("|")getMessage\1\s*?\)/g), "Your code should use the <code>document.getElementById</code> method to select the <code>getMessage</code> element.");'
testString: assert(code.match(/document\.getElementById\(\s*?('|")getMessage\1\s*?\)/g), 'Your code should use the <code>document.getElementById</code> method to select the <code>getMessage</code> element.');
- text: Your code should add an <code>onclick</code> event handler.
testString: 'assert(typeof document.getElementById("getMessage").onclick === "function", "Your code should add an <code>onclick</code> event handler.");'
testString: assert(typeof document.getElementById('getMessage').onclick === 'function', 'Your code should add an <code>onclick</code> event handler.');
```

View File

@ -26,17 +26,17 @@ Update the code to create and send a "POST" request. Then enter your name in inp
```yml
tests:
- text: Your code should create a new <code>XMLHttpRequest</code>.
testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), "Your code should create a new <code>XMLHttpRequest</code>.");'
testString: assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), 'Your code should create a new <code>XMLHttpRequest</code>.');
- text: Your code should use the <code>open</code> method to initialize a "POST" request to the server.
testString: 'assert(code.match(/\.open\(\s*?("|")POST\1\s*?,\s*?url\s*?,\s*?true\s*?\)/g), "Your code should use the <code>open</code> method to initialize a "POST" request to the server.");'
testString: assert(code.match(/\.open\(\s*?('|")POST\1\s*?,\s*?url\s*?,\s*?true\s*?\)/g), 'Your code should use the <code>open</code> method to initialize a "POST" request to the server.');
- text: Your code should use the <code>setRequestHeader</code> method.
testString: 'assert(code.match(/\.setRequestHeader\(\s*?("|")Content-Type\1\s*?,\s*?("|")text\/plain\2\s*?\)/g), "Your code should use the <code>setRequestHeader</code> method.");'
testString: assert(code.match(/\.setRequestHeader\(\s*?('|")Content-Type\1\s*?,\s*?('|")text\/plain\2\s*?\)/g), 'Your code should use the <code>setRequestHeader</code> method.');
- text: Your code should have an <code>onreadystatechange</code> event handler set to a function.
testString: 'assert(code.match(/\.onreadystatechange\s*?=/g), "Your code should have an <code>onreadystatechange</code> event handler set to a function.");'
testString: assert(code.match(/\.onreadystatechange\s*?=/g), 'Your code should have an <code>onreadystatechange</code> event handler set to a function.');
- text: Your code should get the element with class <code>message</code> and change its inner HTML to the <code>responseText</code>.
testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?.+?\.responseText/g), "Your code should get the element with class <code>message</code> and change its inner HTML to the <code>responseText</code>.");'
testString: assert(code.match(/document\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?.+?\.responseText/g), 'Your code should get the element with class <code>message</code> and change its inner HTML to the <code>responseText</code>.');
- text: Your code should use the <code>send</code> method.
testString: 'assert(code.match(/\.send\(\s*?userName\s*?\)/g), "Your code should use the <code>send</code> method.");'
testString: assert(code.match(/\.send\(\s*?userName\s*?\)/g), 'Your code should use the <code>send</code> method.');
```

View File

@ -23,7 +23,7 @@ Add code to <code>filter</code> the json data to remove the cat with the "id" va
```yml
tests:
- text: Your code should use the <code>filter</code> method.
testString: 'assert(code.match(/json\.filter/g), "Your code should use the <code>filter</code> method.");'
testString: assert(code.match(/json\.filter/g), 'Your code should use the <code>filter</code> method.');
```

View File

@ -23,7 +23,7 @@ Add code to use the <code>imageLink</code> and <code>altText</code> properties i
```yml
tests:
- text: You should use the <code>imageLink</code> property to display the images.
testString: 'assert(code.match(/val\.imageLink/g), "You should use the <code>imageLink</code> property to display the images.");'
testString: assert(code.match(/val\.imageLink/g), 'You should use the <code>imageLink</code> property to display the images.');
```