# react-native-fetch-mock
[![Build Status](https://travis-ci.org/WhatAKitty/react-native-fetch-mock.svg?branch=master)](https://travis-ci.org/WhatAKitty/react-native-fetch-mock)

fetch mock for react-native

## Why FetchMock ?
No fetch mock could be used easily for react-native.  
So, I create one by myself.

## Roadmap
- [x] Combined with Mock.js

## Usage
```
import FetchMock from 'react-native-fetch-mock';

if (__dev__) {
  global.fetch = FetchMock(require('path/to/mocks/directory'));
}

// if __dev__ is true, it will back the data you defined in mock directory
fetch('/api/path', options);
```
## LICENSE

MIT

# react-native-fetch-mock
[![Build Status](https://travis-ci.org/WhatAKitty/react-native-fetch-mock.svg?branch=master)](https://travis-ci.org/WhatAKitty/react-native-fetch-mock)

fetch mock for react-native

## Why FetchMock ?
No fetch mock could be used easily for react-native.  
So, I create one by myself.

## Roadmap
- [x] Combined with Mock.js

## Usage

__ mocks__/index.js
```
export default {
  '/api/path': async (options) => {
    const all = Mock.mock({
      'list|2': [{
        'id|+1': 1,
        'name': '@first @last',
        'age|18-54': 1,
      }]
    }).list;
    return {
      data: all,
    }
  }
}
```
index.js
```
import FetchMock from 'react-native-fetch-mock';

if (__dev__) {
  global.fetch = FetchMock(require('path/to/mocks/directory'));
}

// if __dev__ is true, it will back the data you defined in mock directory
fetch('/api/path', options);
```
## LICENSE

MIT

Add more description with fetchMock
Add more description with fetchMock
