Skip to content

Commit

Permalink
Test schema subset copy enum directives
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Apr 16, 2024
1 parent 5f1ca24 commit 08108c8
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions tests/test_copy_schema_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,3 +771,61 @@ def test_copy_schema_subset_excludes_directive_arg_and_type(gql):

directives = {d.name: d for d in copied_schema.directives}
assert not directives["custom"].args


def test_copy_schema_subset_includes_enum_directive(gql):
schema_str = gql(
"""
directive @custom on ENUM
enum Role @custom {
USER
ADMIN
}
type Query {
lorem: Role!
ipsum: Int!
dolor: Int!
met: Int!
}
"""
)
schema = build_ast_schema(parse(schema_str))

copied_schema = copy_schema(
schema,
queries=["lorem", "dolor"],
exclude_directives=["custom"],
)
assert "Role" in copied_schema.type_map
assert_directive_doesnt_exist(copied_schema, "custom")


def test_copy_schema_subset_includes_enum_value_directive(gql):
schema_str = gql(
"""
directive @custom on ENUM_VALUE
enum Role {
USER
ADMIN @custom
}
type Query {
lorem: Role!
ipsum: Int!
dolor: Int!
met: Int!
}
"""
)
schema = build_ast_schema(parse(schema_str))

copied_schema = copy_schema(
schema,
queries=["lorem", "dolor"],
exclude_directives=["custom"],
)
assert "Role" in copied_schema.type_map
assert_directive_doesnt_exist(copied_schema, "custom")

0 comments on commit 08108c8

Please sign in to comment.