Move test-main.js

I didn't like how it was cluttering up the specs directory.
A load of error handling

Handle edge-cases & dodgy input
Docs
A few tests for acceptable pub() input

NaN, undefined & null are replaced with {} when passed to pub()