ccarruitero / makemehapi

Self guided workshops to teach you about hapi.
https://www.npmjs.com/package/makemehapi
Other
480 stars 107 forks source link

Views - confusing results using 'makemehapi verify' #155

Closed ghost closed 9 years ago

ghost commented 9 years ago

The following output confused me for a while, because the output is correct (but fails). What finally made this test PASS was simply adding a blank line at the end of the HTML in the template. Without a blank line at the end, this test fails with insufficient explanation (see below):

Your submission results compared to the expected:

────────────────────────────────────────────

  1. ACTUAL: ""
  2. EXPECTED: ""
  3. ACTUAL: " Hello the handling"
  4. EXPECTED: " Hello the handling"
  5. ACTUAL: " "
  6. EXPECTED: " "
  7. ACTUAL: " Hello the handling"
  8. EXPECTED: " Hello the handling"
  9. ACTUAL: " "
  10. EXPECTED: " "
  11. ACTUAL: ""
  12. EXPECTED: ""
  13. ACTUAL: ""
  14. EXPECTED: ""
  15. ACTUAL:
  16. EXPECTED: ""

────────────────────────────────────────────

✗ Submission results did not match expected!

FAIL

Your solution to VIEWS didn't pass. Try again!

ghost commented 9 years ago

github changed the numbering when I saved it in this post (above), should have been 1,1,2,2, etc. as it displays when output to the console.

fiveisprime commented 9 years ago

I see what you mean, the final comparison is pretty misleading; it's showing that expected empty string doesn't match actual of nothing. Not so helpful..

1.  ACTUAL:    "<html>"
1.  EXPECTED:  "<html>"

2.  ACTUAL:    "    <head><title>Hello the handling</title></head>"
2.  EXPECTED:  "    <head><title>Hello the handling</title></head>"

3.  ACTUAL:    "    <body>"
3.  EXPECTED:  "    <body>"

4.  ACTUAL:    "        Hello the handling"
4.  EXPECTED:  "        Hello the handling"

5.  ACTUAL:    "    </body>"
5.  EXPECTED:  "    </body>"

6.  ACTUAL:    "</html>"
6.  EXPECTED:  "</html>"

7.  ACTUAL:    ""
7.  EXPECTED:  ""

8.  ACTUAL:    
8.  EXPECTED:  ""

I'll add a note note in the hints section regarding the expectation for a newline at EOF.

Thanks for pointing this out :)

lloydbenson commented 9 years ago

You'll have to look at the code again @fiveisprime but i recall it uses a joi schema to get an EXACT file match so if you have anything extra it will fail that validation. I'm sure you could change that logic to be more relaxed.

fiveisprime commented 9 years ago

@lloydbenson I was hoping that would be the case, but it looks like the actual validation is handled in the workshopper-exercise module, which compares solutionStdout and submissionStdout directly.

I could probably try to be smart and add/remove the trailing newline, but I don't feel so great about that. I've seen the same issue in other workshoppers (specifically, learnyounode's "my first i/o" exercise) where the "solution" is documentation.

That's how I got here, but I'll keep digging. I really appreciate your suggestion btw :heart:

fiveisprime commented 9 years ago

Fixed in 2.0.1 :+1: