diff --git a/tasks/daemons.js b/tasks/daemons.js index a688c6ab0..0312c229d 100644 --- a/tasks/daemons.js +++ b/tasks/daemons.js @@ -70,11 +70,13 @@ function startDisposableDaemons (callback) { throw err } - ipfsNodes[key].startDaemon((err, ignore) => { + ipfsNodes[key].startDaemon((err, daemon) => { if (err) { throw err } - + daemon.add('test/test-folder', {r: true}, (e, r) => { + if (e) throw e + }) apiAddrs[key] = ipfsNodes[key].apiAddr cb() }) diff --git a/test/api/ls.spec.js b/test/api/ls.spec.js new file mode 100644 index 000000000..009594e15 --- /dev/null +++ b/test/api/ls.spec.js @@ -0,0 +1,26 @@ +'use strict' + +describe('ls', function () { + it('should correctly retrieve links', function (done) { + apiClients['a'].ls('QmTDH2RXGn8XyDAo9YyfbZAUXwL1FCr44YJCN9HBZmL9Gj', (err, res) => { + if (err === null && res !== undefined) { + assert(res.Objects[0].Links[0]) + done() + } + }) + }) + it('should correctly handle a nonexisting hash', function (done) { + apiClients['a'].ls('surelynotavalidhashheh?', (err, res) => { + if (err !== null && res === undefined) { + done() + } + }) + }) + it('should correctly handle a nonexisting path', function (done) { + apiClients['a'].ls('QmTDH2RXGn8XyDAo9YyfbZAUXwL1FCr44YJCN9HBZmL9Gj/folder_that_isnt_there', (err, res) => { + if (err !== null && res === undefined) { + done() + } + }) + }) +})