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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
local ls = require "luasnip"
local t = ls.text_node
local i = ls.insert_node
local c = ls.choice_node
local fmt = require("luasnip.extras.fmt").fmt
local M = {
clean = t [[Given clean stubs list]],
all = t [[And all stubs should be matched]],
status_code = fmt([[Then the response status code should be {}]], { i(1, "200") }),
no_error = t [[And the JSON path expression errors should not have result]],
json_data = fmt([[And the JSON path expression "data" should be equal to:
"""
{{
{}
}}
"""
]], {i(1)}),
feature = fmt(
[[Feature: {}
{}
]],
{
i(1, "Feature Name"),
i(0),
}
),
scenario = fmt(
[[Scenario: {}
{}]],
{
i(1, "Scenario name"),
i(0),
}
),
stub = fmt([[And the APIClient will send a request with a stub from "{}"]], { i(1) }),
request = fmt(
[[When I send the GraphQL request:
"""
{}
"""]],
{ i(1) }
),
result = fmt(
[[And the JSON path expression "data" should be equal to:
"""
{{
"result": {{
{}
}}
}}
"""]],
{ i(1) }
),
query = fmt(
[[{} {{
result: {}({}) {{
{}
}}
}}]],
{ c(1, { t "mutation", t "query" }), i(2, "mutation"), i(3, ""), i(4) }
),
access = fmt(
[[And the Access Cache has Allowed the userId "{}" for inspectionId "{}"]],
{ i(1, "3414054"), i(2, "42") }
),
branch_access = fmt([[And the Access Cache has branch "{}" for userId "{}"]], { i(1, "1"), i(2, "3414054") }),
}
return M
|