Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-mock

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-mock - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

5

dist/index.d.ts
import { ApolloClient } from 'apollo-client';
import { NormalizedCacheObject } from 'apollo-cache-inmemory';
import Expectations from './expect';

@@ -11,6 +10,6 @@ import { GraphQLSchema } from 'graphql';

export default class GraphQLMock {
client: ApolloClient<NormalizedCacheObject>;
client: ApolloClient<any>;
requests: GQLRequest[];
expectations: Expectations;
constructor(schema: string | GraphQLSchema, mocks?: object, resolvers?: any);
constructor(schema: string | GraphQLSchema | ApolloClient<any>, mocks?: object, resolvers?: any);
reset(): void;

@@ -17,0 +16,0 @@ readonly queries: string[];

3

dist/index.js

@@ -15,2 +15,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const apollo_client_1 = require("apollo-client");
const client_1 = require("./client");

@@ -24,3 +25,3 @@ const expect_1 = require("./expect");

this.expectations = new expect_1.default();
this.client = client_1.default(schema, mocks, resolvers);
this.client = schema instanceof apollo_client_1.ApolloClient ? schema : client_1.default(schema, mocks, resolvers);
this.patchClient();

@@ -27,0 +28,0 @@ }

{
"name": "graphql-mock",
"version": "0.2.1",
"version": "0.3.0",
"description": "GraphQL endpoint mockery library for testing",

@@ -5,0 +5,0 @@ "files": [

@@ -113,2 +113,14 @@ # GraphQL Client Side Mocking

## Using Existing ApolloClient
If you have your own flavour configured ApolloClient already setup and ready to go,
you can use it instead of a schema:
```
const mock = new GraphqlMock(myOwnClient);
```
__NOTE__: this is not going to work with url linked clients
## API & Stuff

@@ -115,0 +127,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc