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 +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const isNode = ! global . window
4
+
5
+ describe ( 'ls' , function ( ) {
6
+ it ( 'should correctly retrieve links' , function ( done ) {
7
+ if ( ! isNode ) return done ( )
8
+
9
+ apiClients [ 'a' ] . ls ( 'QmSzLpCVbWnEm3XoTWnv6DT6Ju5BsVoLhzvxKXZeQ2cmdg' , ( err , res ) => {
10
+ expect ( err ) . to . not . exist
11
+
12
+ expect ( res ) . to . have . a . property ( 'Objects' )
13
+ expect ( res . Objects [ 0 ] ) . to . have . a . property ( 'Links' )
14
+ expect ( res . Objects [ 0 ] ) . to . have . property ( 'Hash' , 'QmSzLpCVbWnEm3XoTWnv6DT6Ju5BsVoLhzvxKXZeQ2cmdg' )
15
+ done ( )
16
+ } )
17
+ } )
18
+
19
+ it ( 'should correctly handle a nonexisting hash' , function ( done ) {
20
+ apiClients [ 'a' ] . ls ( 'surelynotavalidhashheh?' , ( err , res ) => {
21
+ expect ( err ) . to . exist
22
+ expect ( res ) . to . not . exist
23
+ done ( )
24
+ } )
25
+ } )
26
+
27
+ it ( 'should correctly handle a nonexisting path' , function ( done ) {
28
+ if ( ! isNode ) return done ( )
29
+
30
+ apiClients [ 'a' ] . ls ( 'QmTDH2RXGn8XyDAo9YyfbZAUXwL1FCr44YJCN9HBZmL9Gj/folder_that_isnt_there' , ( err , res ) => {
31
+ expect ( err ) . to . exist
32
+ expect ( res ) . to . not . exist
33
+ done ( )
34
+ } )
35
+ } )
36
+ } )
You can’t perform that action at this time.
0 commit comments