The Guild LogoThe Guild Monogram
GraphQL Tools

GraphQL Tools

A set of utilities for faster GraphQL development

Get Started

Class: MockList#

mock/src.MockList

This is an object you can return from your mock resolvers which calls the provided mockFunction once for each list item.

Table of contents#

Constructors#

  • constructor

Methods#

Constructors#

constructor#

new MockList(length, mockFunction?)

Parameters#

NameTypeDescription
lengthnumber | number[]Either the exact length of items to return or an inclusive range of possible lengths.
mockFunction?() => unknownThe function to call for each item in the list to resolve it. It can return another MockList or a value.

Defined in#

packages/mock/src/MockList.ts:28

Methods#

mock#

mock(): unknown[]

internal

Returns#

unknown[]

Defined in#

packages/mock/src/MockList.ts:41