freeCodeCamp / curriculum

The freeCodeCamp curriculum and lesson editor
Creative Commons Attribution Share Alike 4.0 International
81 stars 125 forks source link

Improving the curriculum test bed #206

Closed joshalling closed 6 years ago

joshalling commented 6 years ago

I have noticed that a number of the challenges do not have any solutions that are being tested, namely the Responsive Web Design challenges. This became apparent to me recently when I had submitted a pull request that passed all the tests, but had a typo in it that would have broken the updated challenge. Luckily @scissorsneedfoodtoo caught it and the bug was avoided. (#167)

I understand that in many cases it is not possible to test solutions because the assertions rely on elements in the DOM, but there are some tests that only match your code to a regex expression, and these could be tested as in the example below

Test: "assert(code.match(/background:\\s*?linear-gradient\\(35deg,\\s*?(#CCFFFF|#CFF),\\s*?(#FFCCCC|#FCC)\\);/gi), 'The <code>div</code> element should have a <code>linear-gradient</code> <code>background</code> with the specified direction and colors.');"

Solution: "var code = \"<style> div{border-radius: 20px; width: 70%; height: 400px; margin: 50px auto; background: linear-gradient(35deg, #cff, #fcc);}</style><div></div>\""

I would love to work on adding these solutions that are possible, and I will get started on it. Are there any plans to make the assertions that rely on the DOM testable? Because it would be ideal to have every challenge tested to minimize the chances for human error.

nathanhannig commented 6 years ago

is there any FCC documentation related to creating tests?

Nirajn2311 commented 6 years ago

Check both the documents in this folder https://github.com/freeCodeCamp/curriculum/tree/dev/docs

raisedadead commented 6 years ago

:tada: This issue has been resolved in version 3.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: