Socket
Book a DemoInstallSign in
Socket

data-service-mock

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-service-mock

Mocking library to help with simple use cases in tests and sandboxes

latest
npmnpm
Version
0.0.1
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Data Service Mock

ALPHA stages, testing in my own projects to nail down the api

Emulate a data service without having to write all the boiler plate mocks.

Install

npm install data-service-mock -D

Usage

import ServiceMock from 'data-service-mock'
new ServiceMock(columns, mockData, options)

options

  • caseSensitive: true by default

columns

Not really used right now but there are plans for it. ;)

mockData

Should be an array of object literals.

APIs

Still in flux

find(params)

  • params object with key value pairs to search on

Returns an object that helps further filter data down.

To access data, use then.

page(pageNumber)

  • pageNumber a number, filters data down by page, based on limit and results.

Returns object for chaining.

limit(limitCount)

  • limitCount a number, default is 25.

Returns object for chaining

then(cb)

  • cb a function. Gets final data.

FAQs

Package last updated on 05 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts