Skip to content

Commit 066cc90

Browse files
committed
Add an introspection test for multiple directives with arguments applied to a directive
1 parent 843394c commit 066cc90

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

src/type/__tests__/introspection-test.ts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,4 +1873,90 @@ describe('Introspection', () => {
18731873
},
18741874
});
18751875
});
1876+
1877+
it('supports multiple directives with arguments applied to a directive definition', () => {
1878+
const schema = buildASTSchema(
1879+
parse(
1880+
`
1881+
type Query {
1882+
someField: String
1883+
}
1884+
directive @foo(arg: String) repeatable on DIRECTIVE_DEFINITION
1885+
directive @bar(arg: String) on DIRECTIVE_DEFINITION
1886+
directive @baz(arg: String) @foo(arg: "foo1") @foo(arg: "foo2") @bar(arg: "bar") on FIELD_DEFINITION
1887+
`,
1888+
{ experimentalDirectivesOnDirectiveDefinitions: true },
1889+
),
1890+
);
1891+
1892+
const source = `
1893+
{
1894+
__schema {
1895+
directives {
1896+
name
1897+
isRepeatable
1898+
isDeprecated
1899+
deprecationReason
1900+
}
1901+
}
1902+
}
1903+
`;
1904+
1905+
expect(graphqlSync({ schema, source })).to.deep.equal({
1906+
data: {
1907+
__schema: {
1908+
directives: [
1909+
{
1910+
name: 'foo',
1911+
isRepeatable: true,
1912+
isDeprecated: false,
1913+
deprecationReason: null,
1914+
},
1915+
{
1916+
name: 'bar',
1917+
isRepeatable: false,
1918+
isDeprecated: false,
1919+
deprecationReason: null,
1920+
},
1921+
{
1922+
name: 'baz',
1923+
isRepeatable: false,
1924+
isDeprecated: false,
1925+
deprecationReason: null,
1926+
},
1927+
{
1928+
name: 'include',
1929+
isRepeatable: false,
1930+
isDeprecated: false,
1931+
deprecationReason: null,
1932+
},
1933+
{
1934+
name: 'skip',
1935+
isRepeatable: false,
1936+
isDeprecated: false,
1937+
deprecationReason: null,
1938+
},
1939+
{
1940+
name: 'deprecated',
1941+
isRepeatable: false,
1942+
isDeprecated: false,
1943+
deprecationReason: null,
1944+
},
1945+
{
1946+
name: 'specifiedBy',
1947+
isRepeatable: false,
1948+
isDeprecated: false,
1949+
deprecationReason: null,
1950+
},
1951+
{
1952+
name: 'oneOf',
1953+
isRepeatable: false,
1954+
isDeprecated: false,
1955+
deprecationReason: null,
1956+
},
1957+
],
1958+
},
1959+
},
1960+
});
1961+
});
18761962
});

0 commit comments

Comments
 (0)