Skip to content

Commit

Permalink
fix(graphql-compose): Remove deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Jan 25, 2017
1 parent df20242 commit b1391e1
Show file tree
Hide file tree
Showing 21 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions src/resolvers/__tests__/count-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ describe('count() ->', () => {
});
});

describe('Resolver.getOutputType()', () => {
describe('Resolver.getType()', () => {
it('should return GraphQLInt type', () => {
const outputType = count(UserModel, UserTypeComposer).getOutputType();
const outputType = count(UserModel, UserTypeComposer).getType();
expect(outputType).to.equal(GraphQLInt);
});
});
Expand Down
10 changes: 5 additions & 5 deletions src/resolvers/__tests__/createOne-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,21 @@ describe('createOne() ->', () => {
});
});

describe('Resolver.getOutputType()', () => {
describe('Resolver.getType()', () => {
it('should have correct output type name', () => {
const outputType = createOne(UserModel, UserTypeComposer).getOutputType();
const outputType = createOne(UserModel, UserTypeComposer).getType();
expect(outputType).property('name')
.to.equal(`CreateOne${UserTypeComposer.getTypeName()}Payload`);
});

it('should have recordId field', () => {
const outputType = createOne(UserModel, UserTypeComposer).getOutputType();
const outputType = createOne(UserModel, UserTypeComposer).getType();
const recordIdField = new TypeComposer(outputType).getField('recordId');
expect(recordIdField).property('type').to.equal(GraphQLMongoID);
});

it('should have record field', () => {
const outputType = createOne(UserModel, UserTypeComposer).getOutputType();
const outputType = createOne(UserModel, UserTypeComposer).getType();
const recordField = new TypeComposer(outputType).getField('record');
expect(recordField).property('type').to.equal(UserTypeComposer.getType());
});
Expand All @@ -139,7 +139,7 @@ describe('createOne() ->', () => {
fields: () => ({}),
});
typeStorage.set(outputTypeName, existedType);
const outputType = createOne(UserModel, UserTypeComposer).getOutputType();
const outputType = createOne(UserModel, UserTypeComposer).getType();
expect(outputType).to.equal(existedType);
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/resolvers/__tests__/findOne-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ describe('findOne() ->', () => {
});
});

describe('Resolver.getOutputType()', () => {
describe('Resolver.getType()', () => {
it('should return model type', () => {
const outputType = findOne(UserModel, UserTypeComposer).getOutputType();
const outputType = findOne(UserModel, UserTypeComposer).getType();
expect(outputType).to.equal(UserTypeComposer.getType());
});
});
Expand Down
10 changes: 5 additions & 5 deletions src/resolvers/__tests__/removeById-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,21 @@ describe('removeById() ->', () => {
});
});

describe('Resolver.getOutputType()', () => {
describe('Resolver.getType()', () => {
it('should have correct output type name', () => {
const outputType = removeById(UserModel, UserTypeComposer).getOutputType();
const outputType = removeById(UserModel, UserTypeComposer).getType();
expect(outputType.name).to.equal(`RemoveById${UserTypeComposer.getTypeName()}Payload`);
});

it('should have recordId field', () => {
const outputType = removeById(UserModel, UserTypeComposer).getOutputType();
const outputType = removeById(UserModel, UserTypeComposer).getType();
const typeComposer = new TypeComposer(outputType);
expect(typeComposer.hasField('recordId')).to.be.true;
expect(typeComposer.getField('recordId').type).to.equal(GraphQLMongoID);
});

it('should have record field', () => {
const outputType = removeById(UserModel, UserTypeComposer).getOutputType();
const outputType = removeById(UserModel, UserTypeComposer).getType();
const typeComposer = new TypeComposer(outputType);
expect(typeComposer.hasField('record')).to.be.true;
expect(typeComposer.getField('record').type).to.equal(UserTypeComposer.getType());
Expand All @@ -194,7 +194,7 @@ describe('removeById() ->', () => {
fields: () => ({}),
});
typeStorage.set(outputTypeName, existedType);
const outputType = removeById(UserModel, UserTypeComposer).getOutputType();
const outputType = removeById(UserModel, UserTypeComposer).getType();
expect(outputType).to.equal(existedType);
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/resolvers/__tests__/removeMany-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ describe('removeMany() ->', () => {
});
});

describe('Resolver.getOutputType()', () => {
describe('Resolver.getType()', () => {
it('should have correct output type name', () => {
const outputType = removeMany(UserModel, UserTypeComposer).getOutputType();
const outputType = removeMany(UserModel, UserTypeComposer).getType();
expect(outputType).property('name')
.to.equal(`RemoveMany${UserTypeComposer.getTypeName()}Payload`);
});

it('should have numAffected field', () => {
const outputType = removeMany(UserModel, UserTypeComposer).getOutputType();
const outputType = removeMany(UserModel, UserTypeComposer).getType();
const numAffectedField = new TypeComposer(outputType).getField('numAffected');
expect(numAffectedField).property('type').to.equal(GraphQLInt);
});
Expand All @@ -155,7 +155,7 @@ describe('removeMany() ->', () => {
fields: () => ({}),
});
typeStorage.set(outputTypeName, existedType);
const outputType = removeMany(UserModel, UserTypeComposer).getOutputType();
const outputType = removeMany(UserModel, UserTypeComposer).getType();
expect(outputType).to.equal(existedType);
});
});
Expand Down
10 changes: 5 additions & 5 deletions src/resolvers/__tests__/removeOne-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,21 +203,21 @@ describe('removeOne() ->', () => {
});
});

describe('Resolver.getOutputType()', () => {
describe('Resolver.getType()', () => {
it('should have correct output type name', () => {
const outputType = removeOne(UserModel, UserTypeComposer).getOutputType();
const outputType = removeOne(UserModel, UserTypeComposer).getType();
expect(outputType).property('name')
.to.equal(`RemoveOne${UserTypeComposer.getTypeName()}Payload`);
});

it('should have recordId field', () => {
const outputType = removeOne(UserModel, UserTypeComposer).getOutputType();
const outputType = removeOne(UserModel, UserTypeComposer).getType();
const recordIdField = new TypeComposer(outputType).getField('recordId');
expect(recordIdField).property('type').to.equal(GraphQLMongoID);
});

it('should have record field', () => {
const outputType = removeOne(UserModel, UserTypeComposer).getOutputType();
const outputType = removeOne(UserModel, UserTypeComposer).getType();
const recordField = new TypeComposer(outputType).getField('record');
expect(recordField).property('type').to.equal(UserTypeComposer.getType());
});
Expand All @@ -229,7 +229,7 @@ describe('removeOne() ->', () => {
fields: () => ({}),
});
typeStorage.set(outputTypeName, existedType);
const outputType = removeOne(UserModel, UserTypeComposer).getOutputType();
const outputType = removeOne(UserModel, UserTypeComposer).getType();
expect(outputType).to.equal(existedType);
});
});
Expand Down
10 changes: 5 additions & 5 deletions src/resolvers/__tests__/updateById-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,22 @@ describe('updateById() ->', () => {
});
});

describe('Resolver.getOutputType()', () => {
describe('Resolver.getType()', () => {
it('should have correct output type name', () => {
const outputType = updateById(UserModel, UserTypeComposer).getOutputType();
const outputType = updateById(UserModel, UserTypeComposer).getType();
expect(outputType.name)
.to.equal(`UpdateById${UserTypeComposer.getTypeName()}Payload`);
});

it('should have recordId field', () => {
const outputType = updateById(UserModel, UserTypeComposer).getOutputType();
const outputType = updateById(UserModel, UserTypeComposer).getType();
const typeComposer = new TypeComposer(outputType);
expect(typeComposer.hasField('recordId')).to.be.true;
expect(typeComposer.getField('recordId').type).to.equal(GraphQLMongoID);
});

it('should have record field', () => {
const outputType = updateById(UserModel, UserTypeComposer).getOutputType();
const outputType = updateById(UserModel, UserTypeComposer).getType();
const typeComposer = new TypeComposer(outputType);
expect(typeComposer.hasField('record')).to.be.true;
expect(typeComposer.getField('record').type).to.equal(UserTypeComposer.getType());
Expand All @@ -214,7 +214,7 @@ describe('updateById() ->', () => {
fields: () => ({}),
});
typeStorage.set(outputTypeName, existedType);
const outputType = updateById(UserModel, UserTypeComposer).getOutputType();
const outputType = updateById(UserModel, UserTypeComposer).getType();
expect(outputType).to.equal(existedType);
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/resolvers/__tests__/updateMany-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ describe('updateMany() ->', () => {
});
});

describe('Resolver.getOutputType()', () => {
describe('Resolver.getType()', () => {
it('should have correct output type name', () => {
const outputType = updateMany(UserModel, UserTypeComposer).getOutputType();
const outputType = updateMany(UserModel, UserTypeComposer).getType();
expect(outputType).property('name')
.to.equal(`UpdateMany${UserTypeComposer.getTypeName()}Payload`);
});

it('should have numAffected field', () => {
const outputType = updateMany(UserModel, UserTypeComposer).getOutputType();
const outputType = updateMany(UserModel, UserTypeComposer).getType();
const numAffectedField = new TypeComposer(outputType).getField('numAffected');
expect(numAffectedField).property('type').to.equal(GraphQLInt);
});
Expand All @@ -155,7 +155,7 @@ describe('updateMany() ->', () => {
fields: () => ({}),
});
typeStorage.set(outputTypeName, existedType);
const outputType = updateMany(UserModel, UserTypeComposer).getOutputType();
const outputType = updateMany(UserModel, UserTypeComposer).getType();
expect(outputType).to.equal(existedType);
});
});
Expand Down
10 changes: 5 additions & 5 deletions src/resolvers/__tests__/updateOne-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,21 @@ describe('updateOne() ->', () => {
});
});

describe('Resolver.getOutputType()', () => {
describe('Resolver.getType()', () => {
it('should have correct output type name', () => {
const outputType = updateOne(UserModel, UserTypeComposer).getOutputType();
const outputType = updateOne(UserModel, UserTypeComposer).getType();
expect(outputType).property('name')
.to.equal(`UpdateOne${UserTypeComposer.getTypeName()}Payload`);
});

it('should have recordId field', () => {
const outputType = updateOne(UserModel, UserTypeComposer).getOutputType();
const outputType = updateOne(UserModel, UserTypeComposer).getType();
const recordIdField = new TypeComposer(outputType).getField('recordId');
expect(recordIdField).property('type').to.equal(GraphQLMongoID);
});

it('should have record field', () => {
const outputType = updateOne(UserModel, UserTypeComposer).getOutputType();
const outputType = updateOne(UserModel, UserTypeComposer).getType();
const recordField = new TypeComposer(outputType).getField('record');
expect(recordField).property('type').to.equal(UserTypeComposer.getType());
});
Expand All @@ -237,7 +237,7 @@ describe('updateOne() ->', () => {
fields: () => ({}),
});
typeStorage.set(outputTypeName, existedType);
const outputType = updateOne(UserModel, UserTypeComposer).getOutputType();
const outputType = updateOne(UserModel, UserTypeComposer).getType();
expect(outputType).to.equal(existedType);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function count(
}

return new Resolver({
outputType: GraphQLInt,
type: GraphQLInt,
name: 'count',
kind: 'query',
args: {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/createOne.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function createOne(
name: 'createOne',
kind: 'mutation',
description: 'Create one document with mongoose defaults, setters, hooks and validation',
outputType,
type: outputType,
args: {
...recordHelperArgs(typeComposer, {
recordTypeName: `CreateOne${typeComposer.getTypeName()}Input`,
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/findById.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function findById(
}

return new Resolver({
outputType: typeComposer.getType(),
type: typeComposer.getType(),
name: 'findById',
kind: 'query',
args: {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/findByIds.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function findByIds(
}

return new Resolver({
outputType: new GraphQLList(typeComposer.getType()),
type: new GraphQLList(typeComposer.getType()),
name: 'findByIds',
kind: 'query',
args: {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/findMany.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function findMany(
}

return new Resolver({
outputType: new GraphQLList(typeComposer.getType()),
type: new GraphQLList(typeComposer.getType()),
name: 'findMany',
kind: 'query',
args: {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/findOne.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function findOne(
}

return new Resolver({
outputType: typeComposer.getType(),
type: typeComposer.getType(),
name: 'findOne',
kind: 'query',
args: {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/removeById.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function removeById(
description: 'Remove one document: '
+ '1) Retrieve one document and remove with hooks via findByIdAndRemove. '
+ '2) Return removed document.',
outputType,
type: outputType,
args: {
_id: {
name: '_id',
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/removeMany.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function removeMany(
description: 'Remove many documents without returning them: '
+ 'Use Query.remove mongoose method. '
+ 'Do not apply mongoose defaults, setters, hooks and validation. ',
outputType,
type: outputType,
args: {
...filterHelperArgs(typeComposer, model, {
filterTypeName: `FilterRemoveMany${typeComposer.getTypeName()}Input`,
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/removeOne.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function removeOne(
description: 'Remove one document: '
+ '1) Remove with hooks via findOneAndRemove. '
+ '2) Return removed document.',
outputType,
type: outputType,
args: {
...filterHelperArgs(typeComposer, model, {
filterTypeName: `FilterRemoveOne${typeComposer.getTypeName()}Input`,
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/updateById.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function updateById(
+ '2) Apply updates to mongoose document. '
+ '3) Mongoose applies defaults, setters, hooks and validation. '
+ '4) And save it.',
outputType,
type: outputType,
args: {
...recordHelperArgs(typeComposer, {
recordTypeName: `UpdateById${typeComposer.getTypeName()}Input`,
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/updateMany.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function updateMany(
description: 'Update many documents without returning them: '
+ 'Use Query.update mongoose method. '
+ 'Do not apply mongoose defaults, setters, hooks and validation. ',
outputType,
type: outputType,
args: {
...recordHelperArgs(typeComposer, {
recordTypeName: `UpdateMany${typeComposer.getTypeName()}Input`,
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/updateOne.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function updateOne(
+ '2) Apply updates to mongoose document. '
+ '3) Mongoose applies defaults, setters, hooks and validation. '
+ '4) And save it.',
outputType,
type: outputType,
args: {
...recordHelperArgs(typeComposer, {
recordTypeName: `UpdateOne${typeComposer.getTypeName()}Input`,
Expand Down

0 comments on commit b1391e1

Please sign in to comment.