You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: __tests__/api-writer/glua-api-writer.spec.ts
+32-1Lines changed: 32 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ import { apiDefinition as hookApiDefinition, json as hookJson } from '../test-da
3
3
// import { apiDefinition as libraryFunctionApiDefinition, json as libraryFunctionJson } from '../test-data/offline-sites/gmod-wiki/library-function-ai-getscheduleid';
@@ -35,6 +35,37 @@ describe('GLua API Writer', () => {
35
35
expect(api).toEqual(structApiDefinition);
36
36
});
37
37
38
+
it('should write optional parameters with a question mark',()=>{
39
+
constwriter=newGluaApiWriter();
40
+
// Non-existant page, only to test the optional parameter
41
+
constapi=writer.writePage(<LibraryFunction>{
42
+
name: 'Explode',
43
+
address: 'Global.Explode',
44
+
parent: '_G',
45
+
dontDefineParent: true,
46
+
description: 'Explodes with an optional intensity.',
47
+
realm: 'Shared',
48
+
type: 'libraryfunc',
49
+
url: 'na',
50
+
arguments: [
51
+
{
52
+
name: 'intensity',
53
+
type: 'number',
54
+
description: 'The intensity of the explosion.',
55
+
default: '1000',
56
+
},
57
+
],
58
+
returns: [
59
+
{
60
+
type: 'number',
61
+
description: 'The amount of damage done.',
62
+
},
63
+
],
64
+
});
65
+
66
+
expect(api).toEqual(`---[SHARED] Explodes with an optional intensity.\n---\n---[(View on wiki)](na)\n---@param intensity? number The intensity of the explosion.\n---@return number #The amount of damage done.\nfunction _G.Explode(intensity) end\n\n`);
67
+
});
68
+
38
69
it('should allow overriding specific page addresses',()=>{
0 commit comments