diff --git a/src/index.js b/src/index.js index 4a4a865..cc259ad 100644 --- a/src/index.js +++ b/src/index.js @@ -16,7 +16,7 @@ const matchSp = (uri) => { const verify = (uri, fingerprint, opts) => { if (!validUrl.isUri(uri)) { - throw new Error('The provided URI was not valid') + throw new Error('Not a valid URI') } const spMatches = matchSp(uri) diff --git a/test/verify.test.js b/test/verify.test.js index 3194f7e..183cc38 100644 --- a/test/verify.test.js +++ b/test/verify.test.js @@ -37,6 +37,10 @@ describe('verify', () => { expect(doipjs.verify).to.be.a('function') expect(doipjs.verify).to.have.length(3) }) + it('should throw an error for non-valid URIs', () => { + expect(() => { doipjs.verify('noURI') }).to.throw('Not a valid URI') + expect(() => { doipjs.verify('domain.org') }).to.throw('Not a valid URI') + }) it('should match "dns:domain.org" to the DNS service provider', () => { const matches = doipjs.verify('dns:domain.org', null, {returnMatchesOnly: true}) expect(matches).to.be.a('array')