Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* @flow */
import { schemaComposer } from 'graphql-compose';
export default schemaComposer.createInputTC({
name: 'AwsConfig',
fields: {
accessKeyId: 'String',
secretAccessKey: 'String',
region: 'String',
},
});
it('should create args.input if not exists and move all args into it', () => {
expect(Object.keys(fieldConfigManyArgsWithoutInput.args)).toEqual(
expect.arrayContaining(['input'])
);
const type: any = getNamedType(fieldConfigManyArgsWithoutInput.args.input.type);
const itc = schemaComposer.createInputTC(type);
expect(itc.hasField('sort')).toBe(true);
expect(itc.hasField('limit')).toBe(true);
expect(itc.hasField('clientMutationId')).toBe(true);
});
it('should add `clientMutationId` field to args.input', () => {
const itc = schemaComposer.createInputTC(fieldConfig.args.input.type);
expect(itc.hasField('clientMutationId')).toBe(true);
expect(itc.getFieldType('clientMutationId')).toBe(GraphQLString);
});
shapes?: AwsShapes
): InputTypeComposer {
const fields = {};
if (param.members) {
Object.keys(param.members).forEach(fname => {
fields[fname] = this.convertParam(
param.members[fname],
`${name}${upperFirst(fname)}`,
true,
shapes
);
});
}
const itc = schemaComposer.createInputTC({
name: `${name}Input`,
fields,
});
if (Array.isArray(param.required)) {
itc.makeRequired(param.required);
}
return itc;
}