Socket
Socket
Sign inDemoInstall

airview-mock-server

Package Overview
Dependencies
113
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    airview-mock-server

Airview Mock Server provides seed data and mock API endpoints for use with `airview-cms` package. Its intent is to allow:


Version published
Weekly downloads
8
decreased by-87.88%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Airview Mock Server

Airview Mock Server provides seed data and mock API endpoints for use with airview-cms package. Its intent is to allow:

  1. local development, without hitting the real GitHub API
  2. A reliable service to facilitate testing

Installation

The package can be installed via npm, within your working directory run:

npm i airview-mock-server

Note: A requirement for the project is node.js LTS, currently greater that version 16.15.1 but less than version 17.0.0

Setup and Configuration

The package has a dependency of Mock Service Worker; documenting MSW package is outside the scope of this README, therefore an understanding of this library is a prerequisite.

AirviewMockServer

Airview Mock Server exports a function AirviewMockServer; this accepts arguments to configue the service and will return the nessesary Mock Service Worker handlers and helper methods

Signature:

  • Name: airviewMockServer
  • Arguments:
    • delay: string - delay in milliseconds, defaults to 500 - optional
    • domain: string - domain prefix for MSW calls, defaults to null - optional
  • Returns: object
    • handlers: array - an array of Mock Service Worker handlers
    • resetStore: function () => void - resets the seed data

Example:

import { setupWorker } from "msw";
import { AirviewMockServer } from "airview-mock-server";

function initAirviewMockServer() {
  const { handlers } = new AirviewMockServer(500);
  const worker = setupWorker(...handlers);
  worker.start();
}

initAirviewMockServer();

Contributing to the package

Please see our documentation here for guidance

Issues, bugs and feature requests

Please see our documentation here for guidance

FAQs

Last updated on 18 Apr 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc