Skip to content

Commit

Permalink
Merge d8a0c09 into bb8086f
Browse files Browse the repository at this point in the history
  • Loading branch information
DevSide committed Aug 10, 2020
2 parents bb8086f + d8a0c09 commit fe26302
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
38 changes: 21 additions & 17 deletions README.md
Expand Up @@ -6,9 +6,9 @@
[![Build Status](https://travis-ci.com/DevSide/dynamock.svg?branch=master)](https://travis-ci.com/DevSide/dynamock)
[![Coverage Status](https://coveralls.io/repos/github/DevSide/dynamock/badge.svg?branch=master)](https://coveralls.io/github/DevSide/dynamock?branch=master)

`dynamock` is a dynamic mock/fixture HTTP server designed for functional testing.
`dynamock` is a dynamic mock/fixture HTTP server designed for functional testing.<br>

## Install
## Installation

```bash
yarn add dynamock -D
Expand Down Expand Up @@ -55,21 +55,18 @@ fetch('http://localhost:3001/products/1', { method: 'GET' })
Dynamock is designed to remove the fixture once consumed, see options.lifetime to adapt this behavior.

```js
fetch('http://localhost:3001/products/1', { method: 'GET' })
.then(response => assert.equal(response.status, 404)
fetch('http://localhost:3001/products/1', { method: 'GET' }).then(response => assert.equal(response.status, 404))
```

## Property response matching

By default, dynamock uses partial matching for
## Api
By default, dynamock uses partial matching for `headers`, `query` and `cookies`.

### Configuration
## Configuration api

Using the configuration is optional. However it gives the ability of reusing redundant data across requests and simplifying fixtures setup.
Using the configuration is optional. However, it gives the ability of reusing redundant data across requests and simplifying fixtures setup.

#### <img src="https://img.shields.io/badge/GET-61affe.svg" alt="GET" /> /\_\_\_config - **Retrieve configuration**
### <img src="https://img.shields.io/badge/GET-61affe.svg" alt="GET" /> /\_\_\_config - **Retrieve configuration**

**Responses**

Expand All @@ -93,7 +90,7 @@ Example:
}
```

#### <img src="https://img.shields.io/badge/PUT-fca130.svg" alt="PUT" /> /\_\_\_config - **Update configuration**
### <img src="https://img.shields.io/badge/PUT-fca130.svg" alt="PUT" /> /\_\_\_config - **Update configuration**

**Request**

Expand Down Expand Up @@ -170,13 +167,15 @@ Wrong configuration format

<br/>

#### <img src="https://img.shields.io/badge/DELETE-f93e3e.svg" alt="DELETE" /> /\_\_\_config - **Reset configuration**
### <img src="https://img.shields.io/badge/DELETE-f93e3e.svg" alt="DELETE" /> /\_\_\_config - **Reset configuration**

**Responses**

- Status 204 - NO CONTENT

### Fixtures
<br>

## Fixtures api

A fixture is composed of:

Expand All @@ -185,7 +184,7 @@ A fixture is composed of:

<br/>

#### <img src="https://img.shields.io/badge/POST-49cc90.svg" alt="POST" /> /\_\_\_fixtures - **Add fixture**
### <img src="https://img.shields.io/badge/POST-49cc90.svg" alt="POST" /> /\_\_\_fixtures - **Add fixture**

**Request**

Expand Down Expand Up @@ -378,7 +377,7 @@ Route {METHOD} ${PATH} is already registered.

<br/>

#### <img src="https://img.shields.io/badge/POST-49cc90.svg" alt="POST" /> /\_\_\_fixtures/bulk - **Bulk add fixtures**
### <img src="https://img.shields.io/badge/POST-49cc90.svg" alt="POST" /> /\_\_\_fixtures/bulk - **Bulk add fixtures**

It is meant to setup multiple fixtures at once.

Expand Down Expand Up @@ -497,7 +496,7 @@ Another fixture with the same request is already registered

<br/>

#### <img src="https://img.shields.io/badge/DELETE-f93e3e.svg" alt="DELETE" /> /\_\_\_fixtures/:id - **Delete a fixture**
### <img src="https://img.shields.io/badge/DELETE-f93e3e.svg" alt="DELETE" /> /\_\_\_fixtures/:id - **Delete a fixture**

**Request**

Expand All @@ -521,8 +520,13 @@ Example:

<br/>

#### <img src="https://img.shields.io/badge/DELETE-f93e3e.svg" alt="DELETE" /> /\_\_\_fixtures - **Delete all fixtures**
### <img src="https://img.shields.io/badge/DELETE-f93e3e.svg" alt="DELETE" /> /\_\_\_fixtures - **Delete all fixtures**

**Responses**

- Status 204 - NO CONTENT

## Next features

- Handle other web protocols like https or websocket
- Security tokens for public environments
13 changes: 10 additions & 3 deletions package.json
Expand Up @@ -3,6 +3,16 @@
"version": "1.1.1",
"description": "Dynamic mock server which serves fixtures based on property matching",
"repository": "https://github.com/DevSide/dynamock",
"keywords": [
"fixtures",
"mock",
"server",
"e2e",
"end-to-end",
"functional testing"
],
"author": "DevSide",
"license": "MIT",
"bin": "bin/dynamock.js",
"main": "src/createServer.js",
"scripts": {
Expand All @@ -15,9 +25,6 @@
"engines": {
"node": ">=10"
},
"keywords": [],
"author": "DevSide",
"license": "MIT",
"dependencies": {
"@hapi/joi": "17.1.1",
"body-parser": "1.19.0",
Expand Down

0 comments on commit fe26302

Please sign in to comment.