Skip to Content
GraphQL Tools
DocumentationAPI@graphql-tools/mocksrcclassesMockList

Class: MockList

Defined in: packages/mock/src/MockList.ts:21

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

Constructors

Constructor

new MockList(length, mockFunction?): MockList

Defined in: packages/mock/src/MockList.ts:31

Parameters

length

number | number[]

Either the exact length of items to return or an inclusive range of possible lengths.

mockFunction?

() => unknown

The function to call for each item in the list to resolve it. It can return another MockList or a value.

Returns

MockList

Methods

mock()

mock(): unknown[]

Defined in: packages/mock/src/MockList.ts:44

Internal

Returns

unknown[]