@@ -7,8 +7,11 @@ package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
7
7
:gsub (' /./' , ' /' ):gsub (' /+$' , ' ' )) .. ' /../../?.lua' .. ' ;' ..
8
8
package.path
9
9
10
+ local tap = require (' tap' )
11
+ local yaml = require (' yaml' )
10
12
local avro = require (' avro_schema' )
11
13
local graphql = require (' graphql' )
14
+ local utils = require (' graphql.utils' )
12
15
local testdata = require (' test.testdata.common_testdata' )
13
16
14
17
-- init box, upload test data and acquire metadata
@@ -77,7 +80,47 @@ local gql_wrapper = graphql.new({
77
80
-- run queries
78
81
-- -----------
79
82
80
- testdata .run_queries (gql_wrapper )
83
+ local function run_queries (gql_wrapper )
84
+ local test = tap .test (' unflatten_tuple' )
85
+ test :plan (1 )
86
+
87
+ local query_1 = [[
88
+ query user_by_order($order_id: String) {
89
+ order_collection(order_id: $order_id) {
90
+ order_id
91
+ description
92
+ user_connection {
93
+ user_id
94
+ last_name
95
+ first_name
96
+ }
97
+ }
98
+ }
99
+ ]]
100
+
101
+ local exp_result_1 = yaml .decode (([[
102
+ ---
103
+ order_collection:
104
+ - order_id: order_id_1
105
+ description: first order of Ivan$
106
+ user_connection:
107
+ user_id: user_id_1
108
+ last_name: Ivanov$
109
+ first_name: Ivan$
110
+ ]] ):strip ())
111
+
112
+ local result = utils .show_trace (function ()
113
+ local variables_1 = {order_id = ' order_id_1' }
114
+ local gql_query_1 = gql_wrapper :compile (query_1 )
115
+ return gql_query_1 :execute (variables_1 )
116
+ end )
117
+
118
+ test :is_deeply (result , exp_result_1 , ' 1' )
119
+
120
+ assert (test :check (), ' check plan' )
121
+ end
122
+
123
+ run_queries (gql_wrapper )
81
124
82
125
-- clean up
83
126
-- --------
0 commit comments