diff --git a/test/test-path.spec.js b/test/test-path.spec.js index 2aa74d8..8858330 100644 --- a/test/test-path.spec.js +++ b/test/test-path.spec.js @@ -108,6 +108,12 @@ describe('ipfs path', () => { done() }) + it('isIPFS.urlOrPath should match an IANA-schema compliant ipfs url', (done) => { + const actual = isIPFS.urlOrPath('ipfs://QmYHNYAaYK5hm3ZhZFx5W9H6xydKDGimjdgJMrMSdnctEm') + expect(actual).to.equal(true) + done() + }) + it('isIPFS.urlOrPath should match ipns url', (done) => { const actual = isIPFS.urlOrPath('http://ipfs.io/ipns/foo.bar.com') expect(actual).to.equal(true) diff --git a/test/test-url.spec.js b/test/test-url.spec.js index d45acff..dfad1b4 100644 --- a/test/test-url.spec.js +++ b/test/test-url.spec.js @@ -12,6 +12,12 @@ describe('ipfs url', () => { done() }) + it('isIPFS.ipfsUrl should match an IANA-schema compliant ipfs uri', (done) => { + const actual = isIPFS.ipfsUrl('ipfs://QmYHNYAaYK5hm3ZhZFx5W9H6xydKDGimjdgJMrMSdnctEm') + expect(actual).to.equal(true) + done() + }) + it('isIPFS.ipfsUrl should match a complex ipfs url', (done) => { const actual = isIPFS.ipfsUrl('http://ipfs.alexandria.media/ipfs/QmeWz9YZEeNFXQhHg4PnR5ZiNr5isttgi5n1tc1eD5EfGU/content/index.html?arg=val#hash') expect(actual).to.equal(true) @@ -72,12 +78,24 @@ describe('ipfs url', () => { done() }) + it('isIPFS.ipnsUrl should not match an IANA-schema compliant ipfs uri', (done) => { + const actual = isIPFS.ipnsUrl('ipfs://QmYHNYAaYK5hm3ZhZFx5W9H6xydKDGimjdgJMrMSdnctEm') + expect(actual).to.equal(false) + done() + }) + it('isIPFS.url should match an ipfs url', (done) => { const actual = isIPFS.url('http://ipfs.io/ipfs/QmYHNYAaYK5hm3ZhZFx5W9H6xydKDGimjdgJMrMSdnctEm') expect(actual).to.equal(true) done() }) + it('isIPFS.url should match an IANA-schema compliant ipfs uri', (done) => { + const actual = isIPFS.url('ipfs://QmYHNYAaYK5hm3ZhZFx5W9H6xydKDGimjdgJMrMSdnctEm') + expect(actual).to.equal(true) + done() + }) + it('isIPFS.url should match an ipns url', (done) => { const actual = isIPFS.url('http://ipfs.io/ipns/github.com/') expect(actual).to.equal(true)