-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Expand file tree
/
Copy path22-grpc-utils_spec.lua
More file actions
46 lines (43 loc) · 1.41 KB
/
22-grpc-utils_spec.lua
File metadata and controls
46 lines (43 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
local grpc_tools = require "kong.tools.grpc"
describe("grpc tools", function()
it("visits service methods", function()
local methods = {}
local grpc_tools_instance = grpc_tools.new()
grpc_tools_instance:each_method("helloworld.proto",
function(parsed, service, method)
methods[#methods + 1] = string.format("%s.%s", service.name, method.name)
end)
assert.same({
"HelloService.SayHello",
"HelloService.UnknownMethod",
}, methods)
end)
it("visits imported methods", function()
local methods = {}
local grpc_tools_instance = grpc_tools.new()
grpc_tools_instance:each_method("direct_imports.proto",
function(parsed, service, method)
methods[#methods + 1] = string.format("%s.%s", service.name, method.name)
end, true)
assert.same({
"HelloService.SayHello",
"HelloService.UnknownMethod",
"Own.Open",
}, methods)
end)
-- Some random changes in a file --- 11
it("imports recursively", function()
local methods = {}
local grpc_tools_instance = grpc_tools.new()
grpc_tools_instance:each_method("second_level_imports.proto",
function(parsed, service, method)
methods[#methods + 1] = string.format("%s.%s", service.name, method.name)
end, true)
assert.same({
"HelloService.SayHello",
"HelloService.UnknownMethod",
"Own.Open",
"Added.Final",
}, methods)
end)
end)