Skip to content

Commit

Permalink
Tests: Remove excessive dependencies and async/await (#1269)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored and leebyron committed Mar 5, 2018
1 parent a62eea8 commit 323f2d2
Show file tree
Hide file tree
Showing 10 changed files with 438 additions and 464 deletions.
2 changes: 0 additions & 2 deletions resources/mocha-bootload.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
*/

var chai = require('chai');
chai.use(require('chai-json-equal'));
chai.use(require('chai-spies-next'));
chai.use(require('chai-subset'));

process.on('unhandledRejection', function (error) {
Expand Down
8 changes: 4 additions & 4 deletions src/execution/__tests__/abstract-promise-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ describe('Execute: Handles execution of abstract types with promises', () => {

const result = await graphql(schema, query);

expect(result).to.jsonEqual({
expect(result).to.deep.equal({
data: {
pets: [
{
Expand Down Expand Up @@ -428,7 +428,7 @@ describe('Execute: Handles execution of abstract types with promises', () => {

const result = await graphql(schema, query);

expect(result).to.jsonEqual({
expect(result).to.deep.equal({
data: {
pets: [
{
Expand Down Expand Up @@ -513,7 +513,7 @@ describe('Execute: Handles execution of abstract types with promises', () => {

const result = await graphql(schema, query);

expect(result).to.jsonEqual({
expect(result).to.deep.equal({
data: {
pets: [
{
Expand Down Expand Up @@ -585,7 +585,7 @@ describe('Execute: Handles execution of abstract types with promises', () => {

const result = await graphql(schema, query);

expect(result).to.jsonEqual({
expect(result).to.deep.equal({
data: {
pets: [null, null],
},
Expand Down
28 changes: 14 additions & 14 deletions src/execution/__tests__/abstract-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import {
graphql,
graphqlSync,
GraphQLSchema,
GraphQLObjectType,
GraphQLInterfaceType,
Expand Down Expand Up @@ -39,7 +39,7 @@ class Human {
}

describe('Execute: Handles execution of abstract types', () => {
it('isTypeOf used to resolve runtime type for Interface', async () => {
it('isTypeOf used to resolve runtime type for Interface', () => {
const PetType = new GraphQLInterfaceType({
name: 'Pet',
fields: {
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('Execute: Handles execution of abstract types', () => {
}
}`;

const result = await graphql(schema, query);
const result = graphqlSync(schema, query);

expect(result).to.deep.equal({
data: {
Expand All @@ -112,7 +112,7 @@ describe('Execute: Handles execution of abstract types', () => {
});
});

it('isTypeOf used to resolve runtime type for Union', async () => {
it('isTypeOf used to resolve runtime type for Union', () => {
const DogType = new GraphQLObjectType({
name: 'Dog',
isTypeOf: obj => obj instanceof Dog,
Expand Down Expand Up @@ -163,7 +163,7 @@ describe('Execute: Handles execution of abstract types', () => {
}
}`;

const result = await graphql(schema, query);
const result = graphqlSync(schema, query);

expect(result).to.deep.equal({
data: {
Expand All @@ -181,7 +181,7 @@ describe('Execute: Handles execution of abstract types', () => {
});
});

it('resolveType on Interface yields useful error', async () => {
it('resolveType on Interface yields useful error', () => {
const PetType = new GraphQLInterfaceType({
name: 'Pet',
resolveType(obj) {
Expand Down Expand Up @@ -252,9 +252,9 @@ describe('Execute: Handles execution of abstract types', () => {
}
}`;

const result = await graphql(schema, query);
const result = graphqlSync(schema, query);

expect(result).to.jsonEqual({
expect(result).to.deep.equal({
data: {
pets: [
{
Expand All @@ -279,7 +279,7 @@ describe('Execute: Handles execution of abstract types', () => {
});
});

it('resolveType on Union yields useful error', async () => {
it('resolveType on Union yields useful error', () => {
const HumanType = new GraphQLObjectType({
name: 'Human',
fields: {
Expand Down Expand Up @@ -346,9 +346,9 @@ describe('Execute: Handles execution of abstract types', () => {
}
}`;

const result = await graphql(schema, query);
const result = graphqlSync(schema, query);

expect(result).to.jsonEqual({
expect(result).to.deep.equal({
data: {
pets: [
{
Expand All @@ -373,7 +373,7 @@ describe('Execute: Handles execution of abstract types', () => {
});
});

it('resolveType allows resolving with type name', async () => {
it('resolveType allows resolving with type name', () => {
const PetType = new GraphQLInterfaceType({
name: 'Pet',
resolveType(obj) {
Expand Down Expand Up @@ -429,9 +429,9 @@ describe('Execute: Handles execution of abstract types', () => {
}
}`;

const result = await graphql(schema, query);
const result = graphqlSync(schema, query);

expect(result).to.jsonEqual({
expect(result).to.deep.equal({
data: {
pets: [
{
Expand Down
Loading

0 comments on commit 323f2d2

Please sign in to comment.