-
Notifications
You must be signed in to change notification settings - Fork 192
Assignment 7 improvements #209
Comments
Hi @jd73 ,
In summary, the generate scripts mentioned above are just test helpers. When a test needs a valid |
Yeah, that makes sense for what the high level purpose of generateSession and later generateCrumb is. For me, I am mostly confused about the details of how exactly it does that. This line in generateSession is particularly cryptic.
I can tell that it is regex matching parts of the cookie header. I really have no idea what that regex is looking for though. Even adding just a comment with the expected before format and what the expected output should be would be very helpful, IMO. Or, if this is a pretty standard thing when working with cookies (I haven't done much with them myself) then maybe adding a comment with a link to some explanation of what the format is and what this regex is doing instead would be of use. Regarding tests depending on users.json, I am definitely okay with them depending on users.js. But, I actually meant that it appears that the auth-cookie tests depend on user.js. I had copied the implementations of both user.js and auth-cookie from the accepted solution to try to work backwards from that to where I was starting from. When I used both implementations the tests for auth-cookie passed fine. When I swapped the solution's user.js for my work-in-progress user.js that validates input but doesn't yet contain any auth stuff, tests for auth-cookie (the accepted solution) started failing. I looked at the refactor you linked to here. I like it so far. I like breaking the assignment down into different steps. I believe that may address the biggest source of my struggles which is just trying to figure out what order to implement things in so that when I work on one part, other pieces it depends upon are already completed. That does make me wonder if perhaps breaking it up like that could be considered a hint separate from the requirements so that those who know what they are doing or want a challenge can try to figure that problem out for themselves? Also, thank you for the quick response. And please let me know if there is anything more specific I can do to help. I certainly don't want to make requests and expect others to do all the hard work. |
@jd73 your thoughts and perspective are helpful. I think the main points of this discussion will In respect to the .match(regex), the regex is from hapi-auth-cookie's tests. I believe the hapi-auth-cookie author's wrote the regex for hapi-auth-cookie's tests . Interestingly, this regex and the tests point to two important hapi concepts: 100% test coverage and using tests as documentation. the tests are a form of documentationIMHO, most people approach hapi wanting a tutorial or documentation to explain everything about hapi. Note, Our discussion of the match(regex) shows how
Perhaps, we need to write a tutorial/guide explaining how to parse request headers and cookies. Once, someone understands to use |
@jd73 good point about auth-cookie.js depending on user.js. |
I didn't get that generateSession was using an authenticated request to get a valid auth cookie before. I created a pull request adding some clarifying comments. #212 |
I've been working through all the updated assignments. They've all worked pretty well for me up to assignment 7.
In comparison to the others, the scope of assignment 7 seems to be quite large. Not only are there more pieces to the assignment but the pieces themselves seem more complicated. I have looked through the currently accepted solution to try to reverse engineer how it works but I have come across a few main problems with that.
Would it be possible to rework the assignment or at the very least the solution to it a bit in order to try to isolate what exactly needs to be done in order to get the desired auth setup to work?
I would be happy to help contribute to some refactoring. As of right now I am not sure exactly where I would start but I will continue to try to figure out how things work and may do some cleanup on my own if I am able to.
The text was updated successfully, but these errors were encountered: