Ejemplo n.º 1
0
def test_purge_directives_retain_federation_directives():
    type_defs = """
        type Query {
            rootField: String
        }

        type Review @key(fields: "id") {
            id: ID!
            body: String
            author: User @provides(fields: "email")
            product: Product @provides(fields: "upc")
        }

        type User @key(fields: "email") @extends {
            email: String @external
            reviews: [Review]
        }

        type Product @key(fields: "upc") @extends {
            upc: String @external
            reviews: [Review]
        }
    """

    assert sic(purge_schema_directives(type_defs)) == sic(type_defs)
Ejemplo n.º 2
0
def test_purge_directives_remove_custom_directives():
    type_defs = """
        directive @custom on FIELD

        type Query {
            rootField: String @custom
        }
    """

    assert sic(purge_schema_directives(type_defs)) == sic("""
            type Query {
                rootField: String
            }
        """)
Ejemplo n.º 3
0
def test_purge_directives_retain_builtin_directives():
    type_defs = """
        type Query {
            rootField: String
        }

        type Product {
            upc: ID!
            name: String
            label: String @deprecated(reason: "Use name instead")
        }
    """

    assert sic(purge_schema_directives(type_defs)) == sic(type_defs)
Ejemplo n.º 4
0
def test_purge_directives_remove_custom_directives_with_single_line_description(
):
    type_defs = """
        "Any Description"
        directive @custom on FIELD
        
        type Query {
            rootField: String @custom
        }
    """

    assert sic(purge_schema_directives(type_defs)) == sic("""
            type Query {
                rootField: String
            }
        """)
Ejemplo n.º 5
0
def test_purge_directives_remove_custom_directives_with_block_string_description(
):
    type_defs = '''
        """
        Any Description
        """
        directive @custom on FIELD
        
        type Query {
            rootField: String @custom
        }
    '''

    assert sic(purge_schema_directives(type_defs)) == sic("""
            type Query {
                rootField: String
            }
        """)