Skip to content

Commit 8e0aa3c

Browse files
committed
small changes in response to PR feedback
1 parent 0032d17 commit 8e0aa3c

File tree

1 file changed

+54
-3
lines changed

1 file changed

+54
-3
lines changed

test/analysis/buildTypeWeights.test.ts

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ describe('Test buildTypeWeightsFromSchema function', () => {
305305
});
306306
});
307307

308-
// FIXME: what would we expect here?
309-
xtest('connections paginiton convention', () => {
308+
// TODO: Write tests for connection pagination convention
309+
xtest('connections pagination convention', () => {
310310
schema = buildSchema(`
311311
type Query {
312312
hero(id: ID): Character
@@ -353,7 +353,7 @@ describe('Test buildTypeWeightsFromSchema function', () => {
353353
weight: 2,
354354
fields: {
355355
totalCount: { weight: 0 },
356-
// edges: {resolveTo: }
356+
// edges: {resolveTo: } //TODO: finish spec'ing out how the typeweight object should look for connections
357357
},
358358
},
359359
friendsEdge: {},
@@ -652,6 +652,57 @@ describe('Test buildTypeWeightsFromSchema function', () => {
652652
});
653653
});
654654

655+
test('interface types', () => {
656+
schema = buildSchema(`
657+
union SearchResult = Human | Droid
658+
interface Character {
659+
id: ID!
660+
name: String!
661+
}
662+
type Human implements Character {
663+
id: ID!
664+
name: String!
665+
homePlanet: String
666+
}
667+
type Droid implements Character {
668+
id: ID!
669+
name: String!
670+
primaryFunction: String
671+
}`);
672+
expect(buildTypeWeightsFromSchema(schema)).toEqual({
673+
searchresult: {
674+
weight: 1,
675+
fields: {
676+
id: { weight: 0 },
677+
name: { weight: 0 },
678+
},
679+
},
680+
character: {
681+
weight: 1,
682+
fields: {
683+
id: { weight: 0 },
684+
name: { weight: 0 },
685+
},
686+
},
687+
human: {
688+
weight: 1,
689+
fields: {
690+
name: { weight: 0 },
691+
homePlanet: { weight: 0 },
692+
id: { weight: 0 },
693+
},
694+
},
695+
droid: {
696+
weight: 1,
697+
fields: {
698+
name: { weight: 0 },
699+
primaryFunction: { weight: 0 },
700+
id: { weight: 0 },
701+
},
702+
},
703+
});
704+
});
705+
655706
test('object types', () => {
656707
schema = buildSchema(`
657708
union SearchResult = Human | Droid

0 commit comments

Comments
 (0)