add mutation set and mutation schema to kwargs-syntax
elbow-jason opened this issue · 3 comments
elbow-jason commented
add mutation set and mutation schema to kwargs-syntax
elbow-jason commented
Also mutation delete.
elbow-jason commented
mutation set and mutation schema add in commit b45e4bb
elbow-jason commented
added mutation delete in 87c76f3
test "mutation set works" do
assert mutation([
set: %Person{
name: "jason",
age: 33,
}
])
|> render
|> clean_format == clean_format("""
mutation {
set {
_:person <name> \"jason\"^^<xs:string> .
_:person <age> \"33\"^^<xs:int> .
}
}
""")
end
test "mutation schema works" do
assert mutation([
schema: Person
])
|> render
|> clean_format == clean_format("""
mutation {
schema {
name: string .
age: int .
works_at: uid .
}
}
""")
end
test "mutation delete works for a field" do
assert mutation([
delete: field(uid("1234567"), "*", "*")
])
|> render
|> clean_format == clean_format("""
mutation {
delete {
<1234567> * * .
}
}
""")
end
test "mutation delete works for tuple of fields " do
assert mutation([
delete: {
field(uid("1234567"), "*", "*"),
field(uid("1234567890"), "*", "*"),
}
])
|> render
|> clean_format == clean_format("""
mutation {
delete {
<1234567> * * .
<1234567890> * * .
}
}
""")
end
test "a complex mutation" do
assert mutation([
delete: {
field(uid("0x123"), :name, "Jason"),
},
set: %Person{
name: "Not Jason",
},
schema: Person,
])
|> render
|> clean_format == clean_format("""
mutation {
delete {
<0x123> <name> \"Jason\" .
}
set {
_:person <name> \"Not Jason\"^^<xs:string> .
}
schema {
name: string .
age: int .
works_at: uid .
}
}
""")
end