Skip to content

Commit fedcbf7

Browse files
Improve test coverage
Last line in multiline table considered as non-covered by luacov if it has no trailing comma. See more about the issue in luacov repo: lunarmodules/luacov#52 Based on PR #18 by @no1seman
1 parent b68ef16 commit fedcbf7

File tree

4 files changed

+66
-66
lines changed

4 files changed

+66
-66
lines changed

graphql/introspection.lua

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,31 @@ __Schema = types.object({
3939
kind = types.nonNull(types.list(types.nonNull(__Type))),
4040
resolve = function(schema)
4141
return util.values(schema:getTypeMap())
42-
end
42+
end,
4343
},
4444

4545
queryType = {
4646
description = 'The type that query operations will be rooted at.',
4747
kind = __Type.nonNull,
4848
resolve = function(schema)
4949
return schema:getQueryType()
50-
end
50+
end,
5151
},
5252

5353
mutationType = {
5454
description = 'If this server supports mutation, the type that mutation operations will be rooted at.',
5555
kind = __Type,
5656
resolve = function(schema)
5757
return schema:getMutationType()
58-
end
58+
end,
5959
},
6060

6161
subscriptionType = {
6262
description = 'If this server supports mutation, the type that mutation operations will be rooted at.',
6363
kind = __Type,
6464
resolve = function(_)
6565
return nil
66-
end
66+
end,
6767
},
6868

6969

@@ -72,7 +72,7 @@ __Schema = types.object({
7272
kind = types.nonNull(types.list(types.nonNull(__Directive))),
7373
resolve = function(schema)
7474
return schema.directives
75-
end
75+
end,
7676
}
7777
}
7878
end
@@ -111,12 +111,12 @@ __Directive = types.object({
111111
if directive.onInlineFragment then table.insert(res, 'INLINE_FRAGMENT') end
112112

113113
return res
114-
end
114+
end,
115115
},
116116

117117
args = {
118118
kind = types.nonNull(types.list(types.nonNull(__InputValue))),
119-
resolve = resolveArgs
119+
resolve = resolveArgs,
120120
}
121121
}
122122
end
@@ -133,33 +133,33 @@ __DirectiveLocation = types.enum({
133133
values = {
134134
QUERY = {
135135
value = 'QUERY',
136-
description = 'Location adjacent to a query operation.'
136+
description = 'Location adjacent to a query operation.',
137137
},
138138

139139
MUTATION = {
140140
value = 'MUTATION',
141-
description = 'Location adjacent to a mutation operation.'
141+
description = 'Location adjacent to a mutation operation.',
142142
},
143143

144144
FIELD = {
145145
value = 'FIELD',
146-
description = 'Location adjacent to a field.'
146+
description = 'Location adjacent to a field.',
147147
},
148148

149149
FRAGMENT_DEFINITION = {
150150
value = 'FRAGMENT_DEFINITION',
151-
description = 'Location adjacent to a fragment definition.'
151+
description = 'Location adjacent to a fragment definition.',
152152
},
153153

154154
FRAGMENT_SPREAD = {
155155
value = 'FRAGMENT_SPREAD',
156-
description = 'Location adjacent to a fragment spread.'
156+
description = 'Location adjacent to a fragment spread.',
157157
},
158158

159159
INLINE_FRAGMENT = {
160160
value = 'INLINE_FRAGMENT',
161-
description = 'Location adjacent to an inline fragment.'
162-
}
161+
description = 'Location adjacent to an inline fragment.',
162+
},
163163
}
164164
})
165165

@@ -205,15 +205,15 @@ __Type = types.object({
205205
end
206206

207207
error('Unknown type ' .. kind)
208-
end
208+
end,
209209
},
210210

211211
fields = {
212212
kind = types.list(types.nonNull(__Field)),
213213
arguments = {
214214
includeDeprecated = {
215215
kind = types.boolean,
216-
defaultValue = false
216+
defaultValue = false,
217217
}
218218
},
219219
resolve = function(kind, arguments)
@@ -233,7 +233,7 @@ __Type = types.object({
233233
if kind.__type == 'Object' then
234234
return kind.interfaces or {}
235235
end
236-
end
236+
end,
237237
},
238238

239239
possibleTypes = {
@@ -242,7 +242,7 @@ __Type = types.object({
242242
if kind.__type == 'Interface' or kind.__type == 'Union' then
243243
return context.schema:getPossibleTypes(kind)
244244
end
245-
end
245+
end,
246246
},
247247

248248
enumValues = {
@@ -256,7 +256,7 @@ __Type = types.object({
256256
return arguments.includeDeprecated or not value.deprecationReason
257257
end)
258258
end
259-
end
259+
end,
260260
},
261261

262262
inputFields = {
@@ -265,12 +265,12 @@ __Type = types.object({
265265
if kind.__type == 'InputObject' then
266266
return util.values(kind.fields)
267267
end
268-
end
268+
end,
269269
},
270270

271271
ofType = {
272-
kind = __Type
273-
}
272+
kind = __Type,
273+
},
274274
}
275275
end
276276
})
@@ -290,24 +290,24 @@ __Field = types.object({
290290

291291
args = {
292292
kind = types.nonNull(types.list(types.nonNull(__InputValue))),
293-
resolve = resolveArgs
293+
resolve = resolveArgs,
294294
},
295295

296296
type = {
297297
kind = __Type.nonNull,
298298
resolve = function(field)
299299
return field.kind
300-
end
300+
end,
301301
},
302302

303303
isDeprecated = {
304304
kind = types.boolean.nonNull,
305305
resolve = function(field)
306306
return field.deprecationReason ~= nil
307-
end
307+
end,
308308
},
309309

310-
deprecationReason = types.string
310+
deprecationReason = types.string,
311311
}
312312
end
313313
})
@@ -330,16 +330,16 @@ __InputValue = types.object({
330330
kind = types.nonNull(__Type),
331331
resolve = function(field)
332332
return field.kind
333-
end
333+
end,
334334
},
335335

336336
defaultValue = {
337337
kind = types.string,
338338
description = 'A GraphQL-formatted string representing the default value for this input value.',
339339
resolve = function(inputVal)
340340
return inputVal.defaultValue and tostring(inputVal.defaultValue) -- TODO improve serialization a lot
341-
end
342-
}
341+
end,
342+
},
343343
}
344344
end
345345
})
@@ -361,7 +361,7 @@ __EnumValue = types.object({
361361
kind = types.boolean.nonNull,
362362
resolve = function(enumValue) return enumValue.deprecationReason ~= nil end
363363
},
364-
deprecationReason = types.string
364+
deprecationReason = types.string,
365365
}
366366
end
367367
})
@@ -372,43 +372,43 @@ __TypeKind = types.enum({
372372
values = {
373373
SCALAR = {
374374
value = 'SCALAR',
375-
description = 'Indicates this type is a scalar.'
375+
description = 'Indicates this type is a scalar.',
376376
},
377377

378378
OBJECT = {
379379
value = 'OBJECT',
380-
description = 'Indicates this type is an object. `fields` and `interfaces` are valid fields.'
380+
description = 'Indicates this type is an object. `fields` and `interfaces` are valid fields.',
381381
},
382382

383383
INTERFACE = {
384384
value = 'INTERFACE',
385-
description = 'Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.'
385+
description = 'Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.',
386386
},
387387

388388
UNION = {
389389
value = 'UNION',
390-
description = 'Indicates this type is a union. `possibleTypes` is a valid field.'
390+
description = 'Indicates this type is a union. `possibleTypes` is a valid field.',
391391
},
392392

393393
ENUM = {
394394
value = 'ENUM',
395-
description = 'Indicates this type is an enum. `enumValues` is a valid field.'
395+
description = 'Indicates this type is an enum. `enumValues` is a valid field.',
396396
},
397397

398398
INPUT_OBJECT = {
399399
value = 'INPUT_OBJECT',
400-
description = 'Indicates this type is an input object. `inputFields` is a valid field.'
400+
description = 'Indicates this type is an input object. `inputFields` is a valid field.',
401401
},
402402

403403
LIST = {
404404
value = 'LIST',
405-
description = 'Indicates this type is a list. `ofType` is a valid field.'
405+
description = 'Indicates this type is a list. `ofType` is a valid field.',
406406
},
407407

408408
NON_NULL = {
409409
value = 'NON_NULL',
410-
description = 'Indicates this type is a non-null. `ofType` is a valid field.'
411-
}
410+
description = 'Indicates this type is a non-null. `ofType` is a valid field.',
411+
},
412412
}
413413
})
414414

@@ -419,19 +419,19 @@ local Schema = {
419419
arguments = {},
420420
resolve = function(_, _, info)
421421
return info.schema
422-
end
422+
end,
423423
}
424424

425425
local Type = {
426426
name = '__type',
427427
kind = __Type,
428428
description = 'Request the type information of a single type.',
429429
arguments = {
430-
name = types.string.nonNull
430+
name = types.string.nonNull,
431431
},
432432
resolve = function(_, arguments, info)
433433
return info.schema:getType(arguments.name)
434-
end
434+
end,
435435
}
436436

437437
local TypeName = {
@@ -441,7 +441,7 @@ local TypeName = {
441441
arguments = {},
442442
resolve = function(_, _, info)
443443
return info.parentType.name
444-
end
444+
end,
445445
}
446446

447447
return {
@@ -458,6 +458,6 @@ return {
458458
fieldMap = {
459459
__schema = Schema,
460460
__type = Type,
461-
__typename = TypeName
462-
}
461+
__typename = TypeName,
462+
},
463463
}

graphql/rules.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function rules.unambiguousSelections(node, context)
162162
local fieldEntry = {
163163
parent = parentType,
164164
field = selection,
165-
definition = definition
165+
definition = definition,
166166
}
167167

168168
validateField(key, fieldEntry)

0 commit comments

Comments
 (0)