Skip to content

Commit

Permalink
test(core/ref): ref from another query used as field in query
Browse files Browse the repository at this point in the history
  • Loading branch information
binier committed Sep 23, 2020
1 parent 027042d commit 07a003f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/core/test/ref.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,20 @@ describe('Ref test', () => {
expect(qStr).toMatch(/q1\(func: uid\(0xe\)\)/);
});

it('return value variable as a value', () => {
it('return value variable from another query as a value', () => {
const q1 = query();
const q = query()
.project({
refValue: q1.ref('rootField', 'nestedField'),
});

const qStr = q.toString();

expect(qStr).toMatch(/rootField {\n.*nestedField: v1 as nestedField/);
expect(qStr).toMatch(/refValue: val\(v1\)/);
});

it('return value variable from same query as a value', () => {
const q = query()
.func(uid('0xe'))
.project(q => ({
Expand Down

0 comments on commit 07a003f

Please sign in to comment.