Skip to content

Commit db87726

Browse files
committed
Actually fix tests
1 parent 5a7b8b6 commit db87726

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

__tests__/test-data/offline-sites/gmod-wiki/hook-player-initial-spawn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ net.Receive( "cool_addon_client_ready", function( len, ply )
128128
end )
129129
\`\`\`\n\n`,
130130
realm: 'Server',
131-
arguments: [
131+
arguments: [ { args: [
132132
{
133133
name: 'player',
134134
type: 'Player',
@@ -139,7 +139,7 @@ end )
139139
type: 'boolean',
140140
description: 'If `true`, the player just spawned from a map transition.',
141141
},
142-
],
142+
], } ],
143143
returns: [],
144144
};
145145

__tests__/test-data/offline-sites/gmod-wiki/library-function-ai-getscheduleid.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ export const json = {
1818
description: 'Translates a schedule name to its corresponding ID.',
1919
realm: 'Server',
2020
arguments: [
21-
{
21+
{ args: [ {
2222
name: 'sched',
2323
type: 'string',
2424
description: 'Then schedule name. In most cases, this will be the same as the Enums/SCHED name.',
25-
},
25+
} ] },
2626
],
2727
returns: [
2828
{

src/api-writer/glua-api-writer.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ export class GluaApiWriter {
180180
private writeClassFunction(func: ClassFunction) {
181181
let api: string = this.writeClassStart(func.parent, undefined, func.deprecated);
182182

183-
for (const argSet of func.arguments ?? [{}]) {
183+
if (!func.arguments || func.arguments.length === 0) func.arguments = [{}];
184+
for (const argSet of func.arguments) {
184185
api += this.writeFunctionLuaDocComment(func, argSet.args, func.realm);
185186
api += this.writeFunctionDeclaration(func, argSet.args, ':');
186187
}
@@ -191,7 +192,8 @@ export class GluaApiWriter {
191192
private writeLibraryFunction(func: LibraryFunction) {
192193
let api: string = this.writeLibraryGlobalFallback(func);
193194

194-
for (const argSet of func.arguments ?? [{}]) {
195+
if (!func.arguments || func.arguments.length === 0) func.arguments = [{}];
196+
for (const argSet of func.arguments) {
195197
api += this.writeFunctionLuaDocComment(func, argSet.args, func.realm);
196198
api += this.writeFunctionDeclaration(func, argSet.args);
197199
}
@@ -212,7 +214,8 @@ export class GluaApiWriter {
212214
private writePanelFunction(func: PanelFunction) {
213215
let api: string = '';
214216

215-
for (const argSet of func.arguments ?? [{}]) {
217+
if (!func.arguments || func.arguments.length === 0) func.arguments = [{}];
218+
for (const argSet of func.arguments) {
216219
api += this.writeFunctionLuaDocComment(func, argSet.args, func.realm);
217220
api += this.writeFunctionDeclaration(func, argSet.args, ':');
218221
}

src/scrapers/wiki-page-markup-scraper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export class WikiPageMarkupScraper extends Scraper<WikiPage> {
320320
address: address,
321321
description: $('description:first').text(),
322322
realm: $('realm:first').text() as Realm,
323-
arguments: argumentList.length == 0 ? undefined : argumentList,
323+
arguments: argumentList,
324324
returns,
325325
deprecated
326326
};

0 commit comments

Comments
 (0)