You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
552 B
19 lines
552 B
const Tom = require('test-runner').Tom
|
|
const fetch = require('node-fetch')
|
|
const LocalWebServer = require('../')
|
|
const a = require('assert')
|
|
|
|
const tom = module.exports = new Tom('test')
|
|
|
|
tom.test('basic', async function () {
|
|
const port = 9000 + this.index
|
|
const localWebServer = new LocalWebServer()
|
|
const server = localWebServer.listen({
|
|
port: port,
|
|
directory: 'test/fixture'
|
|
})
|
|
const response = await fetch(`http://localhost:${port}/one.txt`)
|
|
server.close()
|
|
const body = await response.text()
|
|
a.strictEqual(body, 'one\n')
|
|
})
|