rewrite tests for nodeunit and restructure so we can get test coverage