refactored a chunk of book a test drive

Signed-off-by: Chris Jones <chris@jonezy.org>
refactored book test drive javascript

Signed-off-by: Chris Jones <chris@jonezy.org>
getting some thigns under test

Signed-off-by: Chris Jones <chris@jonezy.org>
cleanup before merge

Signed-off-by: Chris Jones <chris@jonezy.org>
Merge branch 'tests'
Merge pull request #89 from jonezy/master

refactored calculation helpers and added tests