Skip to content
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

simplify predicate-test type #3039

Merged
merged 4 commits into from Apr 14, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 19 additions & 11 deletions src/type/__tests__/predicate-test.js
@@ -1,7 +1,11 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';

import type { GraphQLArgument, GraphQLInputField } from '../definition';
import type {
GraphQLArgument,
GraphQLInputField,
GraphQLInputType,
} from '../definition';
import {
GraphQLDirective,
GraphQLSkipDirective,
Expand Down Expand Up @@ -503,7 +507,7 @@ describe('Type predicates', () => {

describe('getNullableType', () => {
it('returns undefined for no type', () => {
expect(getNullableType()).to.equal(undefined);
expect(getNullableType(undefined)).to.equal(undefined);
expect(getNullableType(null)).to.equal(undefined);
});

Expand Down Expand Up @@ -536,7 +540,7 @@ describe('Type predicates', () => {

describe('getNamedType', () => {
it('returns undefined for no type', () => {
expect(getNamedType()).to.equal(undefined);
expect(getNamedType(undefined)).to.equal(undefined);
expect(getNamedType(null)).to.equal(undefined);
});

Expand All @@ -559,15 +563,18 @@ describe('Type predicates', () => {
});

describe('isRequiredArgument', () => {
function buildArg(config: $Shape<GraphQLArgument>): GraphQLArgument {
function buildArg(config: {
saihaj marked this conversation as resolved.
Show resolved Hide resolved
type: GraphQLInputType,
defaultValue?: mixed,
}): GraphQLArgument {
saihaj marked this conversation as resolved.
Show resolved Hide resolved
return {
name: 'someArg',
type: config.type,
description: undefined,
defaultValue: undefined,
defaultValue: config.defaultValue,
deprecationReason: null,
extensions: undefined,
astNode: undefined,
...config,
};
}

Expand Down Expand Up @@ -604,17 +611,18 @@ describe('Type predicates', () => {
});

describe('isRequiredInputField', () => {
function buildInputField(
config: $Shape<GraphQLInputField>,
): GraphQLInputField {
function buildInputField(config: {
saihaj marked this conversation as resolved.
Show resolved Hide resolved
type: GraphQLInputType,
defaultValue?: mixed,
}): GraphQLInputField {
saihaj marked this conversation as resolved.
Show resolved Hide resolved
return {
name: 'someInputField',
type: config.type,
description: undefined,
defaultValue: undefined,
defaultValue: config.defaultValue,
deprecationReason: null,
extensions: undefined,
astNode: undefined,
...config,
};
}

Expand Down