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

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Jan 9, 2018
1 parent 40fa44e commit 7d26ca6
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/cli/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const expect = require('chai').expect
const runOnAndOff = require('../utils/on-and-off')

const commandCount = 59
const commandCount = 60

describe('commands', () => runOnAndOff((thing) => {
let ipfs
Expand Down
22 changes: 22 additions & 0 deletions test/cli/dns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const runOnAndOff = require('../utils/on-and-off')

describe('dns', () => runOnAndOff((thing) => {
let ipfs

before(function () {
this.timeout(60 * 1000)
ipfs = thing.ipfs
})

it('dns record for ipfs.io', function () {
this.timeout(60 * 1000)

return ipfs('ipfs.io').then((res) => {
expect(res.substr(0, 6)).to.eql('/ipfs/')
})
})
}))
19 changes: 19 additions & 0 deletions test/http-api/extra/dns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)

module.exports = (ctl) => {
describe('.dns', () => {
it('get dns for ipfs.io', (done) => {
ctl.dns('ipfs.io', (err, result) => {
expect(err).to.not.exist()
expect(result).to.exist()
done()
})
})
})
}
24 changes: 24 additions & 0 deletions test/http-api/spec/dns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect

module.exports = (http) => {
describe('/dns', () => {
let api

before(() => {
api = http.api.server.select('API')
})

it('get the id', (done) => {
api.inject({
method: 'GET',
url: '/api/v0/dns?arg=ipfs.io'
}, (res) => {
expect(res).to.have.property('Path')
done()
})
})
})
}

0 comments on commit 7d26ca6

Please sign in to comment.