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.

21 lines
598 B

9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
8 years ago
9 years ago
8 years ago
8 years ago
9 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 usage = require('lws/lib/usage')
  7. usage.disable()
  8. const runner = new TestRunner()
  9. runner.test('basic', async function () {
  10. const port = 9000 + this.index
  11. const localWebServer = new LocalWebServer()
  12. const server = localWebServer.create({
  13. port: port,
  14. directory: 'test/fixture'
  15. })
  16. const response = await request(`http://localhost:${port}/one.txt`)
  17. server.close()
  18. a.strictEqual(response.data.toString(), 'one\n')
  19. })