Thursday, April 23, 2015

4/23/15 - Testing with Sinon

Today I started testing the BookPlayerPageGenerator, and wanted to test that the BookDownloadManager was getting the proper messages. User interface is really hard to test, and one aspect of what I ended up with really bothered me.
I really dislike how long the description inside the it() is. I vaguely recall that when I was starting out in rspec, I learned you don't want to go over a certain character limit with your test description, otherwise it suggests that something is wrong (line 27) with the objects you are working with.  If you are interested, the unabridged test code is here and the object being tested is here.

Also, the test file is getting pretty long (225 lines), and there's a lot of sample constructs defined at the top of the file (like the BOOK_OBJECT and CHAPTER_OBJECT variables shown in this gist) that should be moved into their own file, and maybe even encapsulated in some sort of globals object.  Each object's test should also be moved into its own test file.

No comments:

Post a Comment