rewrite to use toJSON
new tests with mocha/chai