flaska/test/http.test.mjs

29 lines
599 B
JavaScript

import { Eltro as t, assert} from 'eltro'
import { Flaska } from '../flaska.mjs'
import Client from './client.mjs'
const port = 51024
const flaska = new Flaska({})
const client = new Client(port)
flaska.get('/', function(ctx) {
ctx.body = { status: true }
})
t.before(function(cb) {
flaska.listen(port, cb)
})
t.describe('', function() {
t.test('/ should return status true', function() {
return client.get().then(function(body) {
assert.deepEqual(body, { status: true })
})
})
})
t.after(function(cb) {
setTimeout(function() {
flaska.server.close(cb)
}, 1000)
})