4
4
const hat = require ( 'hat' )
5
5
6
6
const { fixture } = require ( './utils' )
7
- const { spawnNodeWithId } = require ( '../utils/spawn' )
8
7
const { getDescribe, getIt, expect } = require ( '../utils/mocha' )
9
8
10
9
module . exports = ( createCommon , options ) => {
@@ -17,41 +16,28 @@ module.exports = (createCommon, options) => {
17
16
let ipfs
18
17
let nodeId
19
18
20
- before ( function ( done ) {
21
- // CI takes longer to instantiate the daemon, so we need to increase the
22
- // timeout for the before step
23
- this . timeout ( 60 * 1000 )
24
-
25
- common . setup ( ( err , factory ) => {
26
- expect ( err ) . to . not . exist ( )
27
-
28
- spawnNodeWithId ( factory , ( err , node ) => {
29
- expect ( err ) . to . not . exist ( )
30
-
31
- ipfs = node
32
- nodeId = node . peerId . id
33
-
34
- ipfs . add ( fixture . data , { pin : false } , done )
35
- } )
36
- } )
19
+ before ( async ( ) => {
20
+ ipfs = await common . setup ( )
21
+ nodeId = ipfs . peerId . id
22
+ await ipfs . add ( fixture . data , { pin : false } )
37
23
} )
38
24
39
- after ( ( done ) => common . teardown ( done ) )
25
+ after ( ( ) => common . teardown ( ) )
40
26
41
27
it ( 'should publish an IPNS record with the default params' , async function ( ) {
42
28
this . timeout ( 50 * 1000 )
43
29
44
30
const value = fixture . cid
45
31
46
- const res = await ipfs . name . publish ( value , { 'allow-offline' : true } )
32
+ const res = await ipfs . name . publish ( value , { allowOffline : true } )
47
33
expect ( res ) . to . exist ( )
48
34
expect ( res . name ) . to . equal ( nodeId )
49
35
expect ( res . value ) . to . equal ( `/ipfs/${ value } ` )
50
36
} )
51
37
52
38
it ( 'should publish correctly with the lifetime option and resolve' , async ( ) => {
53
39
const [ { path } ] = await ipfs . add ( Buffer . from ( 'should publish correctly with the lifetime option and resolve' ) )
54
- await ipfs . name . publish ( path , { 'allow-offline' : true , resolve : false , lifetime : '2h' } )
40
+ await ipfs . name . publish ( path , { allowOffline : true , resolve : false , lifetime : '2h' } )
55
41
56
42
return expect ( await ipfs . name . resolve ( `/ipns/${ nodeId } ` ) ) . to . eq ( `/ipfs/${ path } ` )
57
43
} )
@@ -66,7 +52,7 @@ module.exports = (createCommon, options) => {
66
52
lifetime : '1m' ,
67
53
ttl : '10s' ,
68
54
key : 'self' ,
69
- 'allow-offline' : true
55
+ allowOffline : true
70
56
}
71
57
72
58
const res = await ipfs . name . publish ( value , options )
@@ -84,7 +70,7 @@ module.exports = (createCommon, options) => {
84
70
lifetime : '24h' ,
85
71
ttl : '10s' ,
86
72
key : keyName ,
87
- 'allow-offline' : true
73
+ allowOffline : true
88
74
}
89
75
90
76
const key = await ipfs . key . gen ( keyName , { type : 'rsa' , size : 2048 } )
0 commit comments