This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +53
-1
lines changed Expand file tree Collapse file tree 2 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ module.exports = function (config) {
47
47
basePath : '' ,
48
48
frameworks : [ 'mocha' ] ,
49
49
files : [
50
- 'test/tests.js'
50
+ 'test/tests.js' ,
51
+ 'test/constructor.js'
51
52
] ,
52
53
exclude : [ ] ,
53
54
preprocessors : {
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const ipfsAPI = require ( '../src/index.js' )
4
+ const assert = require ( 'assert' )
5
+
6
+ describe ( 'ipfsAPI constructor tests' , ( ) => {
7
+ describe ( 'parameter permuations' , ( ) => {
8
+ const apiAddrs = require ( './tmp-disposable-nodes-addrs.json' )
9
+ const apiAddr = apiAddrs . a . split ( '/' )
10
+
11
+ function clientWorks ( client , done ) {
12
+ client . id ( ( err , res ) => {
13
+ if ( err ) throw err
14
+ const id = res
15
+ assert ( id . ID )
16
+ assert ( id . PublicKey )
17
+ done ( )
18
+ } )
19
+ }
20
+
21
+ it ( 'opts' , ( done ) => {
22
+ clientWorks ( ipfsAPI ( {
23
+ host : apiAddr [ 2 ] ,
24
+ port : apiAddr [ 4 ] ,
25
+ protocol : 'http'
26
+ } ) , done )
27
+ } )
28
+
29
+ it ( 'mutliaddr, opts' , ( done ) => {
30
+ clientWorks ( ipfsAPI (
31
+ apiAddrs . a ,
32
+ { protocol : 'http' }
33
+ ) , done )
34
+ } )
35
+
36
+ it ( 'host, port' , ( done ) => {
37
+ clientWorks ( ipfsAPI (
38
+ apiAddr [ 2 ] ,
39
+ apiAddr [ 4 ]
40
+ ) , done )
41
+ } )
42
+
43
+ it ( 'host, port, opts' , ( done ) => {
44
+ clientWorks ( ipfsAPI (
45
+ apiAddr [ 2 ] ,
46
+ apiAddr [ 4 ] ,
47
+ { protocol : 'http' }
48
+ ) , done )
49
+ } )
50
+ } )
51
+ } )
You can’t perform that action at this time.
0 commit comments