This mutation (upsert) has one independent query and one independent mutation.
(t *testing.T)
| 2226 | |
| 2227 | // This mutation (upsert) has one independent query and one independent mutation. |
| 2228 | func TestMutationAndQueryButNoUpsert(t *testing.T) { |
| 2229 | require.NoError(t, dropAll()) |
| 2230 | require.NoError(t, alterSchema(` |
| 2231 | email: string @index(exact) . |
| 2232 | works_for: string @index(exact) . |
| 2233 | works_with: [uid] .`)) |
| 2234 | |
| 2235 | m1 := ` |
| 2236 | upsert { |
| 2237 | query { |
| 2238 | q(func: eq(works_for, "company1")) { |
| 2239 | uid |
| 2240 | name |
| 2241 | } |
| 2242 | } |
| 2243 | |
| 2244 | mutation { |
| 2245 | set { |
| 2246 | _:user1 <name> "user1" . |
| 2247 | _:user1 <email> "user1@company1.io" . |
| 2248 | _:user1 <works_for> "company1" . |
| 2249 | } |
| 2250 | } |
| 2251 | }` |
| 2252 | mr, err := mutationWithTs(mutationInp{body: m1, typ: "application/rdf", commitNow: true}) |
| 2253 | require.NoError(t, err) |
| 2254 | result := QueryResult{} |
| 2255 | require.NoError(t, json.Unmarshal(mr.data, &result)) |
| 2256 | require.Equal(t, 0, len(result.Queries["q"])) |
| 2257 | require.Equal(t, []string{"email", "name", "works_for"}, splitPreds(mr.preds)) |
| 2258 | } |
| 2259 | |
| 2260 | func TestMultipleMutation(t *testing.T) { |
| 2261 | require.NoError(t, dropAll()) |
nothing calls this directly
no test coverage detected