MCPcopy
hub / github.com/dgraph-io/dgraph / SetupBankExample

Function SetupBankExample

dgraph/cmd/alpha/upsert_test.go:1737–1771  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1735}
1736
1737func SetupBankExample(t *testing.T) string {
1738 require.NoError(t, dropAll())
1739 require.NoError(t, alterSchema(`
1740name: string @index(exact) .
1741branch: string .
1742amount: bigfloat .`))
1743
1744 m1 := `
1745{
1746 set {
1747 _:user1 <name> "user1" .
1748 _:user1 <amount> "10" .
1749
1750 _:user2 <name> "user2" .
1751 _:user2 <amount> "100" .
1752
1753 _:user3 <name> "user3" .
1754 _:user3 <amount> "1000" .
1755 }
1756}`
1757
1758 _, err := mutationWithTs(mutationInp{body: m1, typ: "application/rdf", commitNow: true})
1759 require.NoError(t, err)
1760 q1 := `
1761{
1762 q(func: has(name)) {
1763 name
1764 amount
1765 }
1766}`
1767 expectedRes, _, err := queryWithTs(queryInp{body: q1, typ: "application/dql"})
1768 require.NoError(t, err)
1769
1770 return expectedRes
1771}
1772
1773func TestBigFloatInvalidInput(t *testing.T) {
1774 SetupBankExample(t)

Callers 10

TestUpsertExampleJSONFunction · 0.85
TestBigFloatInvalidInputFunction · 0.85
TestUpsertSanityCheckFunction · 0.85
TestUpsertEmptyUIDFunction · 0.85

Calls 4

dropAllFunction · 0.85
alterSchemaFunction · 0.85
mutationWithTsFunction · 0.85
queryWithTsFunction · 0.85

Tested by

no test coverage detected