Skip to content

Commit ba9ead8

Browse files
committed
add example for type system directive arguments
1 parent 7912d6d commit ba9ead8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,31 @@ describe('Validate: Values of correct type', () => {
12041204
});
12051205
});
12061206

1207+
describe('Type system directive arguments', () => {
1208+
it('with directives of valid types', () => {
1209+
expectValid(`
1210+
interface Mammal {
1211+
mother: Mammal @deprecated(reason: "Some reason.")
1212+
father: Mammal
1213+
}
1214+
`);
1215+
});
1216+
1217+
it('with directive with incorrect types', () => {
1218+
expectErrors(`
1219+
interface Mammal {
1220+
mother: Mammal @deprecated(reason: 5)
1221+
father: Mammal
1222+
}
1223+
`).toDeepEqual([
1224+
{
1225+
message: 'String cannot represent a non string value: 5',
1226+
locations: [{ line: 3, column: 46 }],
1227+
},
1228+
]);
1229+
});
1230+
});
1231+
12071232
describe('Variable default values', () => {
12081233
it('variables with valid default values', () => {
12091234
expectValid(`

0 commit comments

Comments
 (0)