* tests: fix error verification
So far the error message was not tested at all. This change makes
sure the error will actually be tested for.
* tests: remove unnecessary api calls
`assert.doesNotThrow` does not provide any benefit since it will
only catch errors and then rethrow in case of an error.
* Use node 7+ WHATWG parser for hostname, fixes#1002
* only use URL if host is IPv6, expose parsed URL
* catch invalid URLs, memoize empty obj
* hostname returns empty string when URL throws