This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 55const { spawnNodeWithId } = require ( '../utils/spawn' )
66const { getDescribe, getIt, expect } = require ( '../utils/mocha' )
77const delay = require ( '../utils/delay' )
8+ const CID = require ( 'cids' )
89
910module . exports = ( createCommon , options ) => {
1011 const describe = getDescribe ( options )
@@ -45,6 +46,20 @@ module.exports = (createCommon, options) => {
4546 . to . eq ( `/ipfs/${ path } ` )
4647 } )
4748
49+ it ( 'should resolve a record from peerid as cidv1 in base32' , async function ( ) {
50+ this . timeout ( 20 * 1000 )
51+ const [ { path } ] = await ipfs . add ( Buffer . from ( 'should resolve a record from cidv1b32' ) )
52+ const { id : peerId } = await ipfs . id ( )
53+ await ipfs . name . publish ( path , { 'allow-offline' : true } )
54+
55+ // Represent Peer ID as CIDv1 Base32
56+ // https://github.com/libp2p/specs/blob/master/RFC/0001-text-peerid-cid.md
57+ const keyCid = new CID ( peerId ) . toV1 ( ) . toString ( 'base32' )
58+ const resolvedPath = await ipfs . name . resolve ( `/ipns/${ keyCid } ` )
59+
60+ return expect ( resolvedPath ) . to . equal ( `/ipfs/${ path } ` )
61+ } )
62+
4863 it ( 'should resolve a record recursive === false' , async ( ) => {
4964 const [ { path } ] = await ipfs . add ( Buffer . from ( 'should resolve a record recursive === false' ) )
5065 await ipfs . name . publish ( path , { 'allow-offline' : true } )
You can’t perform that action at this time.
0 commit comments