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

Commit f9f460f

Browse files
hacdiasdaviddias
authored andcommitted
test: /api/v0/dns (#197)
* Add DNS * Update miscellaneous.js
1 parent 5822bcb commit f9f460f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

SPEC/MISCELLANEOUS.md

+23
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,26 @@ ipfs.version((err, version) => {
5252
A great source of [examples][] can be found in the tests for this API.
5353

5454
[examples]: https://github.com/ipfs/interface-ipfs-core/blob/master/src/generic.js
55+
56+
#### `dns`
57+
58+
> Resolve DNS links
59+
60+
##### `Go` **WIP**
61+
62+
##### `JavaScript` - ipfs.dns(domain, [callback])
63+
64+
`callback` must follow `function (err, path) {}` signature, where `err` is an error if the operation was not successful. `path` is the IPFS path for that domain.
65+
66+
If no `callback` is passed, a promise is returned.
67+
68+
**Example:**
69+
70+
```JavaScript
71+
ipfs.dns('ipfs.io', (err, path) => {
72+
if (err) {
73+
throw err
74+
}
75+
console.log(path)
76+
})
77+
```

src/miscellaneous.js

+14
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ module.exports = (common) => {
5050
})
5151
})
5252

53+
it('.dns', () => {
54+
return ipfs.dns('ipfs.io', (err, path) => {
55+
expect(err).to.not.exist()
56+
expect(path).to.exist()
57+
})
58+
})
59+
5360
it('.id Promises support', () => {
5461
return ipfs.id()
5562
.then((res) => {
@@ -66,5 +73,12 @@ module.exports = (common) => {
6673
expect(result).to.have.a.property('repo')
6774
})
6875
})
76+
77+
it('.dns Promises support', () => {
78+
return ipfs.dns('ipfs.io')
79+
.then((res) => {
80+
expect(res).to.exist()
81+
})
82+
})
6983
})
7084
}

0 commit comments

Comments
 (0)