-
-
Save Swizz/7cfca4779602e7f21d5134cead796945 to your computer and use it in GitHub Desktop.
fly-serve test poc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
const test = require('ava') | |
const delay = require('delay') | |
const http = require('ava-http') | |
const Fly = require('fly') | |
test.beforeEach(function (t) { | |
const fly = new Fly({ | |
plugins: [require('../')], | |
tasks: { | |
* serve(fly) { | |
yield fly.source(path.join(__dirname, '*')).serve({port: 3000}) | |
} | |
} | |
}) | |
t.context = {fly} | |
}) | |
test(function * (t) { | |
yield t.context.fly.start('serve') | |
yield delay(500) | |
try { | |
const res = yield http.get('http://localhost:3000') | |
t.is(res, '<h1>It works!</h1>') | |
} catch (err) { | |
t.fail('server not started') | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment