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
543 B

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. 'use strict'
  2. const TestRunner = require('test-runner')
  3. const request = require('req-then')
  4. const LocalWebServer = require('../')
  5. const a = require('assert')
  6. const runner = new TestRunner()
  7. runner.test('basic', async function () {
  8. const port = 9000 + this.index
  9. const localWebServer = new LocalWebServer()
  10. const server = localWebServer.create({
  11. port: port,
  12. directory: 'test/fixture'
  13. })
  14. const response = await request(`http://localhost:${port}/one.txt`)
  15. server.close()
  16. a.strictEqual(response.data.toString(), 'one\n')
  17. })