Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 57e571f

Browse files
committed
add tests
License: MIT Signed-off-by: Rasmus Erik Voel Jensen <[email protected]>
1 parent f613de2 commit 57e571f

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

src/cli/commands/ls.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ module.exports = {
2323
},
2424

2525
handler (argv) {
26-
console.log(argv._.length)
2726
if (argv._.length !== 2) {
2827
throw new Error('Other arguments than single hash not implemented yet.')
2928
}

test/cli/files.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,46 @@ describe('files', () => runOnAndOff((thing) => {
150150
})
151151
})
152152

153+
it('ls', () => {
154+
return ipfs('ls QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2')
155+
.then((out) => {
156+
expect(out).to.eql(
157+
'QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9 123530 blocks\n' +
158+
'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN 3939 config\n' +
159+
'Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz 5503 datastore\n' +
160+
'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU 7397 init-docs\n' +
161+
'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV 10 version\n')
162+
})
163+
})
164+
165+
it('ls -v', () => {
166+
return ipfs('ls QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2 -v')
167+
.then((out) => {
168+
expect(out).to.eql(
169+
'Hash Size Name\n' +
170+
'QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9 123530 blocks\n' +
171+
'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN 3939 config\n' +
172+
'Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz 5503 datastore\n' +
173+
'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU 7397 init-docs\n' +
174+
'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV 10 version\n')
175+
})
176+
})
177+
178+
it('ls --help', () => {
179+
return ipfs('ls --help')
180+
.then((out) => {
181+
expect(out.split('\n').slice(1)).to.eql(['',
182+
'Options:',
183+
' -q, --quiet suppress output [boolean]',
184+
' --help Show help [boolean]',
185+
' -v, --headers Print table headers (Hash, Size, Name).',
186+
' [boolean] [default: false]',
187+
' --resolve-type Resolve linked objects to find out their types. (not',
188+
' implemented yet) [boolean] [default: false]',
189+
'', ''])
190+
})
191+
})
192+
153193
it('get', () => {
154194
return ipfs('files get QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB')
155195
.then((out) => {

test/cli/ls.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)