forked from pfrazee/dat-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
34 lines (28 loc) · 810 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* global describe it before after */
const assert = require('assert')
const http = require('http')
const DatGateway = require('.')
const dir = './fixtures'
describe('dat-gateway', function () {
before(function () {
this.gateway = new DatGateway({ dir })
})
after(function () {
return this.gateway.close().then(() => {
process.exit(0)
})
})
it('should exist', function () {
assert.equal(this.gateway.dir, './fixtures')
})
it('should handle requests', function () {
const gateway = new DatGateway({ dir: './fixtures' })
return gateway.listen(5917).then(() => {
return new Promise((resolve) => {
http.get('http://localhost:5917/garbados.hashbase.io/', resolve)
})
}).then((res) => {
assert.equal(res.statusCode, 200)
})
})
})