Skip to content

Commit bab0bd4

Browse files
committed
add more tests
1 parent 1a7688b commit bab0bd4

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

test/expected/issue_237_field_merging.out

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,70 @@ begin;
305305
}
306306
(1 row)
307307

308+
select graphql.encode('["public", "account", 1]'::jsonb);
309+
encode
310+
----------------------------------
311+
WyJwdWJsaWMiLCAiYWNjb3VudCIsIDFd
312+
(1 row)
313+
314+
select graphql.encode('["public", "blog", 1]'::jsonb);
315+
encode
316+
------------------------------
317+
WyJwdWJsaWMiLCAiYmxvZyIsIDFd
318+
(1 row)
319+
320+
select jsonb_pretty(graphql.resolve($$ {
321+
node(nodeId: "WyJwdWJsaWMiLCAiYWNjb3VudCIsIDFd") {
322+
nodeId
323+
... on Account {
324+
id
325+
str: email
326+
}
327+
... on Blog {
328+
id
329+
str: name
330+
}
331+
}
332+
}
333+
$$));
334+
jsonb_pretty
335+
----------------------------------------------------------
336+
{ +
337+
"data": { +
338+
"node": { +
339+
"id": 1, +
340+
"str": "aardvark@x.com", +
341+
"nodeId": "WyJwdWJsaWMiLCAiYWNjb3VudCIsIDFd"+
342+
} +
343+
} +
344+
}
345+
(1 row)
346+
347+
select jsonb_pretty(graphql.resolve($$ {
348+
node(nodeId: "WyJwdWJsaWMiLCAiYmxvZyIsIDFd") {
349+
nodeId
350+
... on Account {
351+
id
352+
str: email
353+
}
354+
... on Blog {
355+
id
356+
str: name
357+
}
358+
}
359+
}
360+
$$));
361+
jsonb_pretty
362+
------------------------------------------------------
363+
{ +
364+
"data": { +
365+
"node": { +
366+
"id": 1, +
367+
"str": "A: Blog 1", +
368+
"nodeId": "WyJwdWJsaWMiLCAiYmxvZyIsIDFd"+
369+
} +
370+
} +
371+
}
372+
(1 row)
373+
308374
rollback;

test/sql/issue_237_field_merging.sql

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,37 @@ begin;
202202
}
203203
$$));
204204

205+
select graphql.encode('["public", "account", 1]'::jsonb);
206+
select graphql.encode('["public", "blog", 1]'::jsonb);
207+
208+
select jsonb_pretty(graphql.resolve($$ {
209+
node(nodeId: "WyJwdWJsaWMiLCAiYWNjb3VudCIsIDFd") {
210+
nodeId
211+
... on Account {
212+
id
213+
str: email
214+
}
215+
... on Blog {
216+
id
217+
str: name
218+
}
219+
}
220+
}
221+
$$));
222+
223+
select jsonb_pretty(graphql.resolve($$ {
224+
node(nodeId: "WyJwdWJsaWMiLCAiYmxvZyIsIDFd") {
225+
nodeId
226+
... on Account {
227+
id
228+
str: email
229+
}
230+
... on Blog {
231+
id
232+
str: name
233+
}
234+
}
235+
}
236+
$$));
237+
205238
rollback;

0 commit comments

Comments
 (0)