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>