@ianwalter/test-server
v2.1.0
Published
Easily create a minimal Koa or Express server for testing
Downloads
24
Maintainers
Readme
@ianwalter/test-server
About
Inspired by create-test-server.
Installation
yarn add @ianwalter/test-server --dev
Usage
const { test } = require('@ianwalter/bff')
const { createKoaServer } = require('@ianwalter/test-server')
const { requester } = require('@ianwalter/requester')
test('requester', ({ expect }) => {
const server = await createKoaServer()
server.use(ctx => (ctx.body = 'Hello World!'))
const response = await requester.get(server.url)
expect(response.body).toBe('Hello World!')
await server.close()
})
License
Apache 2.0 with Commons Clause - See LICENSE
Created by Ian Walter