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

Commit 4a7504f

Browse files
committed
Merge pull request #192 from ipfs/tests/options-version
add remaining version tests
2 parents b81591e + b6d2a27 commit 4a7504f

File tree

2 files changed

+48
-7
lines changed

2 files changed

+48
-7
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,19 @@ The tests folder also contains great examples that can be used to understand how
6969

7070
### Core
7171

72-
##### Block
72+
##### version
7373

74-
##### Object
74+
- [examples](https://github.com/ipfs/js-ipfs-api/blob/master/test/api/version.spec.js)
75+
76+
##### node
77+
78+
> node start and stop are not implemented in the API
79+
80+
- [examples](https://github.com/ipfs/js-ipfs-api/blob/master/test/api/id.spec.js)
81+
82+
##### block
83+
84+
##### object
7585

7686
**Curl**
7787
```sh
@@ -91,7 +101,7 @@ curl 'http://localhost:5001/api/v0/object/get?arg=QmYEqnfCZp7a39Gxrgyv3qRS4MoCTG
91101
```
92102
*Data is base64 encoded.*
93103

94-
##### Pin
104+
##### pin
95105

96106

97107
-------------------------------------------------------
@@ -147,8 +157,6 @@ curl 'http://localhost:5001/api/v0/add?stream-channels=true' \
147157
```
148158
*The name value will only be set for actual files.*
149159

150-
151-
152160
##### cat
153161

154162
Retrieve the contents of a single hash, or array of hashes.
@@ -219,7 +227,7 @@ curl "http://localhost:5001/api/v0/ls?arg=<hash>&stream-channels=true"
219227
}
220228
```
221229

222-
##### Update
230+
##### update
223231

224232
-------------------------------------------------------
225233

test/api/version.spec.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,44 @@
11
'use strict'
22

33
describe('.version', () => {
4+
// note, IPFS HTTP-API returns always the same object, the filtering
5+
// happens on the CLI
46
it('checks the version', done => {
57
apiClients['a'].version((err, res) => {
68
expect(err).to.not.exist
79
expect(res).to.have.a.property('Version')
8-
console.log(' - running against version', res.Version)
10+
expect(res).to.have.a.property('Commit')
11+
expect(res).to.have.a.property('Repo')
12+
done()
13+
})
14+
})
15+
16+
it('with number option', done => {
17+
apiClients['a'].version({number: true}, (err, res) => {
18+
expect(err).to.not.exist
19+
expect(res).to.have.a.property('Version')
20+
expect(res).to.have.a.property('Commit')
21+
expect(res).to.have.a.property('Repo')
22+
done()
23+
})
24+
})
25+
26+
it('with commit option', done => {
27+
apiClients['a'].version({commit: true}, (err, res) => {
28+
expect(err).to.not.exist
29+
expect(res).to.have.a.property('Version')
30+
expect(res).to.have.a.property('Commit')
31+
expect(res).to.have.a.property('Repo')
32+
done()
33+
})
34+
})
35+
36+
it('with repo option', done => {
37+
apiClients['a'].version({commit: true}, (err, res) => {
38+
expect(err).to.not.exist
39+
expect(res).to.have.a.property('Version')
40+
expect(res).to.have.a.property('Commit')
41+
expect(res).to.have.a.property('Repo')
942
done()
1043
})
1144
})

0 commit comments

Comments
 (0)