add count edges
(t *testing.T)
| 573 | |
| 574 | // add count edges |
| 575 | func TestSchemaMutationCountAdd(t *testing.T) { |
| 576 | var q1 = ` |
| 577 | { |
| 578 | user(func:eq(count(friend),4)) { |
| 579 | name |
| 580 | } |
| 581 | } |
| 582 | ` |
| 583 | var m = ` |
| 584 | { |
| 585 | set { |
| 586 | # comment line should be ignored |
| 587 | <0x1> <name> "Alice" . |
| 588 | <0x01> <friend> <0x02> . |
| 589 | <0x01> <friend> <0x03> . |
| 590 | <0x01> <friend> <0x04> . |
| 591 | <0x01> <friend> <0x05> . |
| 592 | } |
| 593 | } |
| 594 | ` |
| 595 | |
| 596 | var s = ` |
| 597 | friend: [uid] @count . |
| 598 | ` |
| 599 | |
| 600 | // reset Schema |
| 601 | require.NoError(t, schema.ParseBytes([]byte(""), 1)) |
| 602 | require.NoError(t, runMutation(m)) |
| 603 | |
| 604 | // add index to name |
| 605 | require.NoError(t, alterSchemaWithRetry(s)) |
| 606 | |
| 607 | time.Sleep(10 * time.Millisecond) |
| 608 | output, err := runGraphqlQuery(q1) |
| 609 | require.NoError(t, err) |
| 610 | require.JSONEq(t, `{"data": {"user":[{"name":"Alice"}]}}`, output) |
| 611 | } |
| 612 | |
| 613 | func TestJsonMutation(t *testing.T) { |
| 614 | var q1 = ` |
nothing calls this directly
no test coverage detected