|
1 | 1 | /* eslint-env mocha */ |
2 | 2 | 'use strict' |
3 | 3 |
|
4 | | -const { Buffer } = require('buffer') |
5 | | -const base58 = require('bs58') |
6 | 4 | const isIPFS = require('../src/index') |
7 | | -const expect = require('chai').expect |
| 5 | +const { expect } = require('aegir/utils/chai') |
| 6 | +const uint8ArrayFromString = require('uint8arrays/from-string') |
8 | 7 |
|
9 | 8 | describe('ipfs path', () => { |
10 | 9 | it('isIPFS.ipfsPath should match an ipfs path', (done) => { |
@@ -37,8 +36,8 @@ describe('ipfs path', () => { |
37 | 36 | done() |
38 | 37 | }) |
39 | 38 |
|
40 | | - it('isIPFS.ipfsPath should not match a buffer data type', (done) => { |
41 | | - const actual = isIPFS.ipfsPath(Buffer.from(base58.decode('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o'))) |
| 39 | + it('isIPFS.ipfsPath should not match a Uint8Array data type', (done) => { |
| 40 | + const actual = isIPFS.ipfsPath(uint8ArrayFromString('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o', 'base58btc')) |
42 | 41 | expect(actual).to.equal(false) |
43 | 42 | done() |
44 | 43 | }) |
@@ -67,8 +66,8 @@ describe('ipfs path', () => { |
67 | 66 | done() |
68 | 67 | }) |
69 | 68 |
|
70 | | - it('isIPFS.ipnsPath should not match a buffer data type', (done) => { |
71 | | - const actual = isIPFS.ipnsPath(Buffer.from(base58.decode('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o'))) |
| 69 | + it('isIPFS.ipnsPath should not match a Uint8Array data type', (done) => { |
| 70 | + const actual = isIPFS.ipnsPath(uint8ArrayFromString('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o', 'base58btc')) |
72 | 71 | expect(actual).to.equal(false) |
73 | 72 | done() |
74 | 73 | }) |
@@ -97,8 +96,8 @@ describe('ipfs path', () => { |
97 | 96 | done() |
98 | 97 | }) |
99 | 98 |
|
100 | | - it('isIPFS.path should not match a buffer data type', (done) => { |
101 | | - const actual = isIPFS.path(Buffer.from(base58.decode('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o'))) |
| 99 | + it('isIPFS.path should not match a Uint8Array data type', (done) => { |
| 100 | + const actual = isIPFS.path(uint8ArrayFromString('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o', 'base58btc')) |
102 | 101 | expect(actual).to.equal(false) |
103 | 102 | done() |
104 | 103 | }) |
@@ -127,8 +126,8 @@ describe('ipfs path', () => { |
127 | 126 | done() |
128 | 127 | }) |
129 | 128 |
|
130 | | - it('isIPFS.urlOrPath should not match a buffer data type', (done) => { |
131 | | - const actual = isIPFS.ipfsPath(Buffer.from(base58.decode('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o'))) |
| 129 | + it('isIPFS.urlOrPath should not match a Uint8Array data type', (done) => { |
| 130 | + const actual = isIPFS.ipfsPath(uint8ArrayFromString('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o', 'base58btc')) |
132 | 131 | expect(actual).to.equal(false) |
133 | 132 | done() |
134 | 133 | }) |
|
0 commit comments