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) let reqBody = null flaska.get('/', function(ctx) { ctx.body = { status: true } }) flaska.post('/test', function(ctx) { ctx.body = { success: true } // console.log(ctx) }) t.before(function() { return flaska.listenAsync(port) }) t.describe('/', function() { t.test('should return status true', function() { return client.get('/').then(function(body) { assert.deepEqual(body, { status: true }) }) }) }) t.describe('/test', function() { t.test('should return success and store body', async function() { reqBody = null let body = await client.post('/test') assert.deepEqual(body, { success: true }) }) }) t.after(function() { return flaska.closeAsync() })