Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit f85fa56

Browse files
committed
Fix unflatten_tuple.test.lua
1 parent 0993e5c commit f85fa56

File tree

2 files changed

+44
-211
lines changed

2 files changed

+44
-211
lines changed

test/local/unflatten_tuple.result

Lines changed: 0 additions & 210 deletions
This file was deleted.

test/local/unflatten_tuple.test.lua

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
77
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' ..
88
package.path
99

10+
local tap = require('tap')
11+
local yaml = require('yaml')
1012
local avro = require('avro_schema')
1113
local graphql = require('graphql')
14+
local utils = require('graphql.utils')
1215
local testdata = require('test.testdata.common_testdata')
1316

1417
-- init box, upload test data and acquire metadata
@@ -77,7 +80,47 @@ local gql_wrapper = graphql.new({
7780
-- run queries
7881
-- -----------
7982

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)
81124

82125
-- clean up
83126
-- --------

0 commit comments

Comments
 (0)