Skip to content

Commit f93c72b

Browse files
committed
test(ComposeWithConnection): Add some cover tests
1 parent 1abb97c commit f93c72b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/__tests__/composeWithConnection-test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,30 @@ describe('composeWithRelay', () => {
3131
expect(() => composeWithConnection(userTypeComposer))
3232
.to.throw('should provide non-empty options');
3333
});
34+
35+
it('should not change `connection` resolver if exists', () => {
36+
let myTC = TypeComposer.create('type Complex { a: String, b: Int }');
37+
myTC.addResolver({
38+
name: 'connection',
39+
resolve: (rp) => 'mockData'
40+
});
41+
42+
// try ovewrite `connection` resolver
43+
myTC = composeWithConnection(myTC, {
44+
countResolverName: 'count',
45+
findResolverName: 'findMany',
46+
sort: sortOptions,
47+
});
48+
49+
expect(myTC.getResolver('connection')).to.be.ok;
50+
expect(myTC.getResolver('connection').resolve()).equal('mockData');
51+
});
52+
});
53+
54+
describe('TypeComposer props', () => {
55+
it('should has `connection` resolver', () => {
56+
expect(userComposer.getResolver('connection')).to.be.ok;
57+
});
3458
});
3559

3660
it('should apply first sort ID_ASC by default', async () => {

0 commit comments

Comments
 (0)