Skip to content

kaelzhang/roe-mock

Repository files navigation

Build Status Coverage

roe-mock

Mock of roe server for testing

Install

$ npm i roe-mock

Usage

const path = require('path')
const create = require('roe-mock')

const baseDir = path.join(__dirname, 'fixtures', 'myApp')
const mock = await create(baseDir)

// Write test cases as well as supertest
await mock.get('/foo/bar')
.expect(200)

create(baseDir, options?)

  • baseDir path base directory contains the roe app
  • options? Object
    • copy? boolean=false if true, roe-mock will copy things inside baseDir to an temp dir before creating the application

Creates an supertest instance with an additional method listen(port) to start the server:

const {
  listen
} = await create(baseDir)

listen(8888) // Server started at 127.0.0.1:8888

License

MIT

About

Mock of roe server for testing

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published