Skip to content

Commit 6ca39cf

Browse files
committed
adding back test
1 parent d0a7f0d commit 6ca39cf

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/__tests__.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ Test('GraphQLComponent instance API (getters/setters)', (t) => {
7878
st.end();
7979
});
8080

81+
t.test('component directives', (st) => {
82+
const component = new GraphQLComponent({
83+
directives: { parentDirective: () => {}},
84+
imports: [new GraphQLComponent({
85+
directives: { childDirective: () => {}}
86+
})]
87+
});
88+
89+
st.equals(Object.keys(component.directives).length, 1, `only component's own directives are returned`);
90+
st.end();
91+
});
92+
8193
t.test('component datasources', (st) => {
8294
const component = new GraphQLComponent({
8395
dataSources: ['parentDataSourcePlaceHolder'],
@@ -900,8 +912,8 @@ Test('component directives imports', (t) => {
900912
})]
901913
});
902914

903-
st.ok(component.schema._directives.filter((directive) => directive.name === 'parent_directive').length, `child component directives exist in merged`);
904-
st.ok(component.schema._directives.filter((directive) => directive.name === 'child_directive').length, `parent component directives exist in merged`);
915+
st.ok(component.schema.getDirective('child_directive'), `child component directives exist in merged`);
916+
st.ok(component.schema.getDirective('parent_directive'), `parent component directives exist in merged`);
905917

906918
st.end();
907919
});

0 commit comments

Comments
 (0)