Skip to content

Commit

Permalink
fix: use resolverName as suffix in Resolver output type name (#35)
Browse files Browse the repository at this point in the history
* fix & test

* fix & test

* trailing comma fix

Co-authored-by: theasmoth <abishetd@gmail.com>
  • Loading branch information
theasmoth and theasmoth committed Dec 28, 2020
1 parent 3e83003 commit 1a8aa26
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/__tests__/pagination-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ describe('preparePaginationResolver()', () => {
})
).toThrowError("'opts.findManyResolver' must be a Resolver instance");
});

it('should return a separate resolver with different type', () => {
const anotherPaginationResolver = preparePaginationResolver(UserTC, {
countResolver,
findManyResolver,
name: 'otherPagination',
});
expect(anotherPaginationResolver.getTypeName()).toBe('UserOtherPagination');
});
});

describe('resolver basic properties', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function preparePaginationResolver<TSource, TContext>(
}

return tc.schemaComposer.createResolver({
type: preparePaginationTC(tc),
type: preparePaginationTC(tc, resolverName),
name: resolverName,
kind: 'query',
args: {
Expand Down

0 comments on commit 1a8aa26

Please sign in to comment.