https://github.com/kaelzhang/roe-mock
Mock of roe server for testing
https://github.com/kaelzhang/roe-mock
roe testing
Last synced: 11 months ago
JSON representation
Mock of roe server for testing
- Host: GitHub
- URL: https://github.com/kaelzhang/roe-mock
- Owner: kaelzhang
- License: other
- Created: 2019-03-27T02:01:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-31T11:34:34.000Z (about 6 years ago)
- Last Synced: 2025-07-21T06:49:35.081Z (11 months ago)
- Topics: roe, testing
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/kaelzhang/roe-mock)
[](https://codecov.io/gh/kaelzhang/roe-mock)
# roe-mock
Mock of roe server for testing
## Install
```sh
$ npm i roe-mock
```
## Usage
```js
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`](https://npmjs.org/package/supertest) instance with an additional method `listen(port)` to start the server:
```js
const {
listen
} = await create(baseDir)
listen(8888) // Server started at 127.0.0.1:8888
```
## License
MIT