Skip to content

tests: in expect chains use '.to.not.' instead of '.not.to.' #2321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/language/__tests__/lexer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ describe('Lexer', () => {
endToken = lexer.advance();
// Lexer advances over ignored comment tokens to make writing parsers
// easier, but will include them in the linked list result.
expect(endToken.kind).not.to.equal(TokenKind.COMMENT);
expect(endToken.kind).to.not.equal(TokenKind.COMMENT);
} while (endToken.kind !== TokenKind.EOF);

expect(startToken.prev).to.equal(null);
Expand Down
42 changes: 21 additions & 21 deletions src/type/__tests__/definition-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const NonNullListOfScalars = GraphQLNonNull(ListOfScalarsType);

describe('Type System: Scalars', () => {
it('accepts a Scalar type defining serialize', () => {
expect(() => new GraphQLScalarType({ name: 'SomeScalar' })).not.to.throw();
expect(() => new GraphQLScalarType({ name: 'SomeScalar' })).to.not.throw();
});

it('accepts a Scalar type defining parseValue and parseLiteral', () => {
Expand All @@ -52,7 +52,7 @@ describe('Type System: Scalars', () => {
parseValue: () => null,
parseLiteral: () => null,
}),
).not.to.throw();
).to.not.throw();
});

it('provides default methods if omitted', () => {
Expand Down Expand Up @@ -291,7 +291,7 @@ describe('Type System: Objects', () => {
},
},
});
expect(() => objType.getFields()).not.to.throw();
expect(() => objType.getFields()).to.not.throw();
});

it('rejects an Object type field with undefined config', () => {
Expand Down Expand Up @@ -438,7 +438,7 @@ describe('Type System: Interfaces', () => {
name: 'AnotherInterface',
fields: { f: { type: ScalarType } },
}),
).not.to.throw();
).to.not.throw();
});

it('accepts an Interface type with an array of interfaces', () => {
Expand Down Expand Up @@ -508,7 +508,7 @@ describe('Type System: Unions', () => {
name: 'SomeUnion',
types: [ObjectType],
}),
).not.to.throw();
).to.not.throw();
});

it('accepts a Union type with array types', () => {
Expand Down Expand Up @@ -801,14 +801,14 @@ describe('Type System: List', () => {
}

it('accepts an type as item type of list', () => {
expectList(ScalarType).not.to.throw();
expectList(ObjectType).not.to.throw();
expectList(UnionType).not.to.throw();
expectList(InterfaceType).not.to.throw();
expectList(EnumType).not.to.throw();
expectList(InputObjectType).not.to.throw();
expectList(ListOfScalarsType).not.to.throw();
expectList(NonNullScalarType).not.to.throw();
expectList(ScalarType).to.not.throw();
expectList(ObjectType).to.not.throw();
expectList(UnionType).to.not.throw();
expectList(InterfaceType).to.not.throw();
expectList(EnumType).to.not.throw();
expectList(InputObjectType).to.not.throw();
expectList(ListOfScalarsType).to.not.throw();
expectList(NonNullScalarType).to.not.throw();
});

it('rejects a non-type as item type of list', () => {
Expand All @@ -831,14 +831,14 @@ describe('Type System: Non-Null', () => {
}

it('accepts an type as nullable type of non-null', () => {
expectNonNull(ScalarType).not.to.throw();
expectNonNull(ObjectType).not.to.throw();
expectNonNull(UnionType).not.to.throw();
expectNonNull(InterfaceType).not.to.throw();
expectNonNull(EnumType).not.to.throw();
expectNonNull(InputObjectType).not.to.throw();
expectNonNull(ListOfScalarsType).not.to.throw();
expectNonNull(ListOfNonNullScalarsType).not.to.throw();
expectNonNull(ScalarType).to.not.throw();
expectNonNull(ObjectType).to.not.throw();
expectNonNull(UnionType).to.not.throw();
expectNonNull(InterfaceType).to.not.throw();
expectNonNull(EnumType).to.not.throw();
expectNonNull(InputObjectType).to.not.throw();
expectNonNull(ListOfScalarsType).to.not.throw();
expectNonNull(ListOfNonNullScalarsType).to.not.throw();
});

it('rejects a non-type as nullable type of non-null', () => {
Expand Down
56 changes: 28 additions & 28 deletions src/type/__tests__/predicate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ describe('Type predicates', () => {
describe('isType', () => {
it('returns true for unwrapped types', () => {
expect(isType(GraphQLString)).to.equal(true);
expect(() => assertType(GraphQLString)).not.to.throw();
expect(() => assertType(GraphQLString)).to.not.throw();
expect(isType(ObjectType)).to.equal(true);
expect(() => assertType(ObjectType)).not.to.throw();
expect(() => assertType(ObjectType)).to.not.throw();
});

it('returns true for wrapped types', () => {
expect(isType(GraphQLNonNull(GraphQLString))).to.equal(true);
expect(() => assertType(GraphQLNonNull(GraphQLString))).not.to.throw();
expect(() => assertType(GraphQLNonNull(GraphQLString))).to.not.throw();
});

it('returns false for type classes (rather than instances)', () => {
Expand All @@ -114,12 +114,12 @@ describe('Type predicates', () => {
describe('isScalarType', () => {
it('returns true for spec defined scalar', () => {
expect(isScalarType(GraphQLString)).to.equal(true);
expect(() => assertScalarType(GraphQLString)).not.to.throw();
expect(() => assertScalarType(GraphQLString)).to.not.throw();
});

it('returns true for custom scalar', () => {
expect(isScalarType(ScalarType)).to.equal(true);
expect(() => assertScalarType(ScalarType)).not.to.throw();
expect(() => assertScalarType(ScalarType)).to.not.throw();
});

it('returns false for scalar class (rather than instance)', () => {
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('Type predicates', () => {
describe('isObjectType', () => {
it('returns true for object type', () => {
expect(isObjectType(ObjectType)).to.equal(true);
expect(() => assertObjectType(ObjectType)).not.to.throw();
expect(() => assertObjectType(ObjectType)).to.not.throw();
});

it('returns false for wrapped object type', () => {
Expand All @@ -179,7 +179,7 @@ describe('Type predicates', () => {
describe('isInterfaceType', () => {
it('returns true for interface type', () => {
expect(isInterfaceType(InterfaceType)).to.equal(true);
expect(() => assertInterfaceType(InterfaceType)).not.to.throw();
expect(() => assertInterfaceType(InterfaceType)).to.not.throw();
});

it('returns false for wrapped interface type', () => {
Expand All @@ -196,7 +196,7 @@ describe('Type predicates', () => {
describe('isUnionType', () => {
it('returns true for union type', () => {
expect(isUnionType(UnionType)).to.equal(true);
expect(() => assertUnionType(UnionType)).not.to.throw();
expect(() => assertUnionType(UnionType)).to.not.throw();
});

it('returns false for wrapped union type', () => {
Expand All @@ -213,7 +213,7 @@ describe('Type predicates', () => {
describe('isEnumType', () => {
it('returns true for enum type', () => {
expect(isEnumType(EnumType)).to.equal(true);
expect(() => assertEnumType(EnumType)).not.to.throw();
expect(() => assertEnumType(EnumType)).to.not.throw();
});

it('returns false for wrapped enum type', () => {
Expand All @@ -230,7 +230,7 @@ describe('Type predicates', () => {
describe('isInputObjectType', () => {
it('returns true for input object type', () => {
expect(isInputObjectType(InputObjectType)).to.equal(true);
expect(() => assertInputObjectType(InputObjectType)).not.to.throw();
expect(() => assertInputObjectType(InputObjectType)).to.not.throw();
});

it('returns false for wrapped input object type', () => {
Expand All @@ -249,7 +249,7 @@ describe('Type predicates', () => {
describe('isListType', () => {
it('returns true for a list wrapped type', () => {
expect(isListType(GraphQLList(ObjectType))).to.equal(true);
expect(() => assertListType(GraphQLList(ObjectType))).not.to.throw();
expect(() => assertListType(GraphQLList(ObjectType))).to.not.throw();
});

it('returns false for an unwrapped type', () => {
Expand All @@ -272,7 +272,7 @@ describe('Type predicates', () => {
expect(isNonNullType(GraphQLNonNull(ObjectType))).to.equal(true);
expect(() =>
assertNonNullType(GraphQLNonNull(ObjectType)),
).not.to.throw();
).to.not.throw();
});

it('returns false for an unwrapped type', () => {
Expand All @@ -293,7 +293,7 @@ describe('Type predicates', () => {
describe('isInputType', () => {
function expectInputType(type) {
expect(isInputType(type)).to.equal(true);
expect(() => assertInputType(type)).not.to.throw();
expect(() => assertInputType(type)).to.not.throw();
}

it('returns true for an input type', () => {
Expand Down Expand Up @@ -337,7 +337,7 @@ describe('Type predicates', () => {
describe('isOutputType', () => {
function expectOutputType(type) {
expect(isOutputType(type)).to.equal(true);
expect(() => assertOutputType(type)).not.to.throw();
expect(() => assertOutputType(type)).to.not.throw();
}

it('returns true for an output type', () => {
Expand Down Expand Up @@ -380,9 +380,9 @@ describe('Type predicates', () => {
describe('isLeafType', () => {
it('returns true for scalar and enum types', () => {
expect(isLeafType(ScalarType)).to.equal(true);
expect(() => assertLeafType(ScalarType)).not.to.throw();
expect(() => assertLeafType(ScalarType)).to.not.throw();
expect(isLeafType(EnumType)).to.equal(true);
expect(() => assertLeafType(EnumType)).not.to.throw();
expect(() => assertLeafType(EnumType)).to.not.throw();
});

it('returns false for wrapped leaf type', () => {
Expand All @@ -404,11 +404,11 @@ describe('Type predicates', () => {
describe('isCompositeType', () => {
it('returns true for object, interface, and union types', () => {
expect(isCompositeType(ObjectType)).to.equal(true);
expect(() => assertCompositeType(ObjectType)).not.to.throw();
expect(() => assertCompositeType(ObjectType)).to.not.throw();
expect(isCompositeType(InterfaceType)).to.equal(true);
expect(() => assertCompositeType(InterfaceType)).not.to.throw();
expect(() => assertCompositeType(InterfaceType)).to.not.throw();
expect(isCompositeType(UnionType)).to.equal(true);
expect(() => assertCompositeType(UnionType)).not.to.throw();
expect(() => assertCompositeType(UnionType)).to.not.throw();
});

it('returns false for wrapped composite type', () => {
Expand All @@ -432,9 +432,9 @@ describe('Type predicates', () => {
describe('isAbstractType', () => {
it('returns true for interface and union types', () => {
expect(isAbstractType(InterfaceType)).to.equal(true);
expect(() => assertAbstractType(InterfaceType)).not.to.throw();
expect(() => assertAbstractType(InterfaceType)).to.not.throw();
expect(isAbstractType(UnionType)).to.equal(true);
expect(() => assertAbstractType(UnionType)).not.to.throw();
expect(() => assertAbstractType(UnionType)).to.not.throw();
});

it('returns false for wrapped abstract type', () => {
Expand All @@ -456,11 +456,11 @@ describe('Type predicates', () => {
describe('isWrappingType', () => {
it('returns true for list and non-null types', () => {
expect(isWrappingType(GraphQLList(ObjectType))).to.equal(true);
expect(() => assertWrappingType(GraphQLList(ObjectType))).not.to.throw();
expect(() => assertWrappingType(GraphQLList(ObjectType))).to.not.throw();
expect(isWrappingType(GraphQLNonNull(ObjectType))).to.equal(true);
expect(() =>
assertWrappingType(GraphQLNonNull(ObjectType)),
).not.to.throw();
).to.not.throw();
});

it('returns false for unwrapped types', () => {
Expand All @@ -472,7 +472,7 @@ describe('Type predicates', () => {
describe('isNullableType', () => {
it('returns true for unwrapped types', () => {
expect(isNullableType(ObjectType)).to.equal(true);
expect(() => assertNullableType(ObjectType)).not.to.throw();
expect(() => assertNullableType(ObjectType)).to.not.throw();
});

it('returns true for list of non-null types', () => {
Expand All @@ -481,7 +481,7 @@ describe('Type predicates', () => {
);
expect(() =>
assertNullableType(GraphQLList(GraphQLNonNull(ObjectType))),
).not.to.throw();
).to.not.throw();
});

it('returns false for non-null types', () => {
Expand Down Expand Up @@ -510,7 +510,7 @@ describe('Type predicates', () => {
describe('isNamedType', () => {
it('returns true for unwrapped types', () => {
expect(isNamedType(ObjectType)).to.equal(true);
expect(() => assertNamedType(ObjectType)).not.to.throw();
expect(() => assertNamedType(ObjectType)).to.not.throw();
});

it('returns false for list and non-null types', () => {
Expand Down Expand Up @@ -636,12 +636,12 @@ describe('Directive predicates', () => {
describe('isDirective', () => {
it('returns true for spec defined directive', () => {
expect(isDirective(GraphQLSkipDirective)).to.equal(true);
expect(() => assertDirective(GraphQLSkipDirective)).not.to.throw();
expect(() => assertDirective(GraphQLSkipDirective)).to.not.throw();
});

it('returns true for custom directive', () => {
expect(isDirective(Directive)).to.equal(true);
expect(() => assertDirective(Directive)).not.to.throw();
expect(() => assertDirective(Directive)).to.not.throw();
});

it('returns false for directive class (rather than instance)', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/__tests__/buildClientSchema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('Type System: build schema from introspection', () => {

// Custom are built
const customScalar = schema.getType('CustomScalar');
expect(clientSchema.getType('CustomScalar')).not.to.equal(customScalar);
expect(clientSchema.getType('CustomScalar')).to.not.equal(customScalar);
});

it('includes standard types only if they are used', () => {
Expand Down