update tests

This commit is contained in:
Lloyd Brookes
2016-06-20 01:02:51 +01:00
parent 343399c1d9
commit 71b2f4dcb4
27 changed files with 371 additions and 367 deletions

1
test/rewrite/one.html Normal file
View File

@ -0,0 +1 @@
one

19
test/rewrite/rewrite.js Normal file
View File

@ -0,0 +1,19 @@
'use strict'
const test = require('tape')
const request = require('req-then')
const LocalWebServer = require('../../')
const c = require('../common')
test('rewrite local', function (t) {
t.plan(2)
const ws = new LocalWebServer()
ws.addRewrite([ { from: '/two.html', to: '/one.html' } ])
ws.addStatic(__dirname)
const server = ws.getServer()
server.listen(8100, () => {
request('http://localhost:8100/two.html')
.then(c.checkResponse(t, 200, /one/))
.then(server.close.bind(server))
.catch(c.fail(t))
})
})