Closed marucjmar closed 3 years ago
Hi,
I need to generate a specific value for mock. This implementation enables me to use my custom value generator. eg.
config:
src/test/factory/graphql.ts: plugins: - add: "import { generateArrayBuffer } from '../generators';" - typescript-mock-data: typesFile: "../../shared/graphql/generated.ts" enumValues: upper-case#upperCase typenames: keep addTypename: true scalars: ArrayBuffer: generateArrayBuffer()
src/test/factory/graphql.ts
import { generateArrayBuffer } from '../generators; export const anPakeProtocol = (overrides?: Partial<PakeProtocol>): PakeProtocol => { return { id: overrides && overrides.hasOwnProperty('id') ? overrides.id! : '1d6a9360-c92b-4660-8e5f-04155047bddc', message: overrides && overrides.hasOwnProperty('message') ? overrides.message! : generateArrayBuffer(), }; };
@ardeois Done :)
@marucjmar I've just noticed the npm publish failed when I merged. It's now fixed https://www.npmjs.com/package/graphql-codegen-typescript-mock-data Your PR is included in version 1.4.0
Hi,
I need to generate a specific value for mock. This implementation enables me to use my custom value generator. eg.
config:
src/test/factory/graphql.ts