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

9 years ago
8 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')
  5. const tom = module.exports = new Tom('test')
  6. tom.test('basic', async function () {
  7. const port = 9000 + this.index
  8. const localWebServer = new LocalWebServer()
  9. const server = localWebServer.listen({
  10. port: port,
  11. directory: 'test/fixture'
  12. })
  13. const response = await fetch(`http://localhost:${port}/one.txt`)
  14. server.close()
  15. const body = await response.text()
  16. a.strictEqual(body, 'one\n')
  17. })