Skip to content

Instantly share code, notes, and snippets.

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