MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestUniqueOneMutattionsTwoHardCodedUIDsDiffValue

Function TestUniqueOneMutattionsTwoHardCodedUIDsDiffValue

systest/unique_test.go:258–274  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

256}
257
258func TestUniqueOneMutattionsTwoHardCodedUIDsDiffValue(t *testing.T) {
259 dg := setUpDgraph(t)
260 require.NoError(t, dg.SetupSchema(`email: string @unique @index(exact) .`))
261
262 rdf := `<0x5> <email> "example@email.com" .
263 <0x6> <email> "example@email.com" . `
264 _, err := dg.Mutate(&api.Mutation{
265 SetNquads: []byte(rdf),
266 CommitNow: true,
267 })
268 require.Error(t, err)
269 require.ErrorContains(t, err, "could not insert duplicate value [example@email.com] for predicate [email]")
270
271 resp, err := dg.Query(emailQuery)
272 require.NoError(t, err)
273 require.NoError(t, dgraphapi.CompareJSON(`{ "q": [ ]}`, string(resp.Json)))
274}
275
276func TestUniqueUpsertMutation(t *testing.T) {
277 dg := setUpDgraph(t)

Callers

nothing calls this directly

Calls 6

CompareJSONFunction · 0.92
setUpDgraphFunction · 0.85
SetupSchemaMethod · 0.80
MutateMethod · 0.65
ErrorMethod · 0.45
QueryMethod · 0.45

Tested by

no test coverage detected