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.

18 lines
500 B

9 years ago
9 years ago
9 years ago
8 years ago
8 years ago
9 years ago
9 years ago
  1. const Tom = require('test-runner').Tom
  2. const fetch = require('node-fetch')
  3. const LocalWebServer = require('../')
  4. const a = require('assert').strict
  5. const tom = module.exports = new Tom()
  6. tom.test('basic', async function () {
  7. const port = 9000 + this.index
  8. const ws = LocalWebServer.create({
  9. port: port,
  10. directory: 'test/fixture'
  11. })
  12. const response = await fetch(`http://localhost:${port}/one.txt`)
  13. ws.server.close()
  14. const body = await response.text()
  15. a.equal(body, 'one\n')
  16. })