Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaelzhang/roe-mock
Mock of roe server for testing
https://github.com/kaelzhang/roe-mock
roe testing
Last synced: 20 days 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 (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-31T11:34:34.000Z (almost 5 years ago)
- Last Synced: 2024-12-13T13:16:24.714Z (21 days ago)
- Topics: roe, testing
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/kaelzhang/roe-mock.svg?branch=master)](https://travis-ci.org/kaelzhang/roe-mock)
[![Coverage](https://codecov.io/gh/kaelzhang/roe-mock/branch/master/graph/badge.svg)](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 applicationCreates 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