2.0.4 • Published 6 years ago
roe-mock v2.0.4
roe-mock
Mock of roe server for testing
Install
$ npm i roe-mockUsage
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
pathbase directory contains the roe app - options?
Object- copy?
boolean=falseif true, roe-mock will copy things insidebaseDirto an temp dir before creating the application
- copy?
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:8888License
MIT