Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit ed298ac

Browse files
committedJan 22, 2016
test(ls): Add tests
Based on the work in #150. Closes #150.
1 parent 483b334 commit ed298ac

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
 

‎test/api/ls.spec.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
})

0 commit comments

Comments
 (0)
This repository has been archived.