Socket
Book a DemoInstallSign in
Socket

@data-eden/mocker

Package Overview
Dependencies
Maintainers
4
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@data-eden/mocker

## Installation

latest
Source
npmnpm
Version
0.18.0
Version published
Maintainers
4
Created
Source

@data-eden/mocker

Installation

yarn add @data-eden/codegen @data-eden/mocker

Usage

Utilizing the gql preprocesing from @data-eden/codegen passing that object to the mocker will be all you need along with the schema to start to generate mocks. By default the mocker mocks out required fields only, passing in the fields will override the default mocking strategy as well as mock out optionals if present in the data passed in.

import { gql } from '@data-eden/codegen/gql';

const carTwoFragment = gql`
  fragment carTwo on Car {
    id
    make
  }
`;

const mocker = new Mocker({
  schema,
});

const result = mocker.mock(carTwoFragment, { id: 1234 });
/**
{
  "id": 1234,
  "make": "whose nor",
}
*/

FAQs

Package last updated on 03 Aug 2023

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