Skip to content

Instantly share code, notes, and snippets.

@mbburch
Forked from rrgayhart/unit-testing-javascript.md
Last active December 8, 2015 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbburch/f7226011c3eecf068049 to your computer and use it in GitHub Desktop.
Save mbburch/f7226011c3eecf068049 to your computer and use it in GitHub Desktop.

Step One: Watch Writing Testable JavaScript - Rebecca Murphey from Full Frontal 2012 (award for worst conference name ever?)

Step Two: Fork this gist.

Step Three: Respond to this question in your fork: Consider the four responsibilities that Rebecca lists for client side code (hint: they're color coded). Respond below with your thoughts. Did any of the responsibilities that she lists surprise you? Do you feel like you mentally split your client side code in IdeaBox and other past projects into these responsibilities?

I had a few good takeaways from this, but it really wasn't that easy for me to separate what she was talking about into the four responsibilities. I don't feel like my IdeaBox in any way split this up, and I'd love to try refactoring it as a practice exercise. I think in Rails apps I had gotten to the point of splitting things up nicely in the models, views, and controllers, and this talk made some points that I could connect to that. Nothing she said surprised me, and I really liked the way she talked about testing and using it to drive her process of organizing the code into the four different areas to detangle it from how it was at the beginning. I also liked the guiding principles: Use constructors to create instances. Support configurability. Keep methods simple. Don’t intermingle the responsibilities below… OH. And test first!

Step Four: Totally Optional: take a look at some of the other forks and comment if the spirit moves you.

@rrgayhart
Copy link

I feel yah.... It's SO frustrating going from feeling comfortable in Rails with testing and learning to really depend on it, and then being like 'I have... no idea... how to do this in JavaScript.' I think that's why a lot of ruby developers have strong negative feels towards JavaScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment