Skip to content

Instantly share code, notes, and snippets.

@ddialar
Created September 28, 2017 12:30
Show Gist options
  • Save ddialar/9a78e3013b1721abacd01f61a41a2af1 to your computer and use it in GitHub Desktop.
Save ddialar/9a78e3013b1721abacd01f61a41a2af1 to your computer and use it in GitHub Desktop.
import 'jest';
import * as graphql from 'graphql';
import * as PhoneNumberType from '../../../src/graphql/models/phone.number.type';
describe('Testing PhoneNumberType ...', () => {
test('fields integrity when it is used as \'ObjectType\'.', () => {
let phoneNumberFields = PhoneNumberType.ObjectType.getFields();
expect(phoneNumberFields).toHaveProperty('number');
expect(phoneNumberFields.number.type).toMatchObject(new graphql.GraphQLNonNull(graphql.GraphQLString));
expect(phoneNumberFields).toHaveProperty('description');
expect(phoneNumberFields.description.type).toMatchObject(graphql.GraphQLString);
});
test('fields integrity when it is used as \'InputType\'.', () => {
let phoneNumberFields = PhoneNumberType.InputType.getFields();
expect(phoneNumberFields).toHaveProperty('number');
expect(phoneNumberFields.number.type).toMatchObject(new graphql.GraphQLNonNull(graphql.GraphQLString));
expect(phoneNumberFields).toHaveProperty('description');
expect(phoneNumberFields.description.type).toMatchObject(graphql.GraphQLString);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment