Skip to content

Commit a047daa

Browse files
committed
Fixed up tests
1 parent 8bbbbe2 commit a047daa

10 files changed

+35
-24
lines changed

__tests__/test-data/offline-sites/gmod-wiki/class-function-weapon-allowsautoswitchto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const json = {
1212
parent: 'Weapon',
1313
name: 'AllowsAutoSwitchTo',
1414
address: 'Weapon:AllowsAutoSwitchTo',
15-
description: 'Returns whether the weapon allows to being switched to when a better ( Weapon:GetWeight ) weapon is being picked up.',
15+
description: 'Returns whether the weapon allows to being switched to when a better ( [Weapon:GetWeight](https://wiki.facepunch.com/gmod/Weapon:GetWeight) ) weapon is being picked up.',
1616
realm: 'Shared',
1717
arguments: [],
1818
returns: [

__tests__/test-data/offline-sites/gmod-wiki/enums-use.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const json = {
1414
type: 'enum',
1515
name: 'USE',
1616
address: 'USE',
17-
description: `\nEnumerations used by ENTITY:Use.\n\nNot to be confused with Enums/_USE used by Entity:SetUseType.\n`,
17+
description: `\nEnumerations used by [ENTITY:Use](https://wiki.facepunch.com/gmod/ENTITY:Use).\n\nNot to be confused with [Enums/_USE](https://wiki.facepunch.com/gmod/Enums/_USE) used by [Entity:SetUseType](https://wiki.facepunch.com/gmod/Entity:SetUseType).\n`,
1818
realm: 'Shared',
1919
items: [
2020
{

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ export const json = {
8585
description: `
8686
Called when the player spawns for the first time.
8787
88-
See GM:PlayerSpawn for a hook called every player spawn.
88+
See [GM:PlayerSpawn](https://wiki.facepunch.com/gmod/GM:PlayerSpawn) for a hook called every player spawn.
8989
90-
This hook is called before the player has fully loaded, when the player is still in seeing the \`Starting Lua\` screen. For example, trying to use the Entity:GetModel function will return the default model (\`models/player.mdl\`).
90+
**NOTE**: This hook is called before the player has fully loaded, when the player is still in seeing the \`Starting Lua\` screen. For example, trying to use the [Entity:GetModel](https://wiki.facepunch.com/gmod/Entity:GetModel) function will return the default model (\`models/player.mdl\`).
9191
92-
You can send net messages starting from the player_activate event (see Game_Events).
9392
94-
Due to the above note, sending net messages to the spawned player in this hook are highly unreliable, and they most likely won't be received (more information here: https://github.com/Facepunch/garrysmod-requests/issues/718).
93+
**NOTE**: You can send [net](https://wiki.facepunch.com/gmod/net) messages starting from the player_activate event (see [Game_Events](https://wiki.facepunch.com/gmod/Game_Events)).
94+
95+
96+
**WARNING**: Due to the above note, sending [net](https://wiki.facepunch.com/gmod/net) messages to the spawned player in this hook are highly unreliable, and they most likely won't be received (more information here: https://github.com/Facepunch/garrysmod-requests/issues/718).
9597
9698
Workaround without networking:
9799
\`\`\`
@@ -148,13 +150,13 @@ GM = {}
148150
149151
---[SERVER] Called when the player spawns for the first time.
150152
---
151-
--- See GM:PlayerSpawn for a hook called every player spawn.
153+
--- See [GM:PlayerSpawn](https://wiki.facepunch.com/gmod/GM:PlayerSpawn) for a hook called every player spawn.
152154
---
153-
--- This hook is called before the player has fully loaded, when the player is still in seeing the \`Starting Lua\` screen. For example, trying to use the Entity:GetModel function will return the default model (\`models/player.mdl\`).
155+
--- **NOTE**: This hook is called before the player has fully loaded, when the player is still in seeing the \`Starting Lua\` screen. For example, trying to use the [Entity:GetModel](https://wiki.facepunch.com/gmod/Entity:GetModel) function will return the default model (\`models/player.mdl\`).
154156
---
155-
--- You can send net messages starting from the player_activate event (see Game_Events).
157+
--- **NOTE**: You can send [net](https://wiki.facepunch.com/gmod/net) messages starting from the player_activate event (see [Game_Events](https://wiki.facepunch.com/gmod/Game_Events)).
156158
---
157-
--- Due to the above note, sending net messages to the spawned player in this hook are highly unreliable, and they most likely won't be received (more information here: https://github.com/Facepunch/garrysmod-requests/issues/718).
159+
--- **WARNING**: Due to the above note, sending [net](https://wiki.facepunch.com/gmod/net) messages to the spawned player in this hook are highly unreliable, and they most likely won't be received (more information here: https://github.com/Facepunch/garrysmod-requests/issues/718).
158160
---
159161
--- Workaround without networking:
160162
--- \`\`\`
@@ -173,7 +175,6 @@ GM = {}
173175
--- end)
174176
--- \`\`\`
175177
---
176-
---
177178
--- With networking:
178179
--- \`\`\`
179180
--- -- CLIENT

__tests__/test-data/offline-sites/gmod-wiki/library-function-concommand-gettable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const apiDefinition =
1313
`--- Missing description.
1414
concommand = {}
1515
16-
---[SHARED AND MENU] Returns the tables of all console command callbacks, and autocomplete functions, that were added to the game with concommand.Add.
16+
---[SHARED AND MENU] Returns the tables of all console command callbacks, and autocomplete functions, that were added to the game with [concommand.Add](https://wiki.facepunch.com/gmod/concommand.Add).
1717
---
1818
---[(View on wiki)](https://wiki.facepunch.com/gmod/concommand.GetTable)
1919
---@return table # Table of command callback functions.

__tests__/test-data/offline-sites/gmod-wiki/library-function-coroutine-resume.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const apiDefinition =
1515
`--- Missing description.
1616
coroutine = {}
1717
18-
---[SHARED AND MENU] Resumes the given coroutine and passes the given vararg to either the function arguments or the coroutine.yield that is inside that function and returns whatever yield is called with the next time or by the final return in the function.
18+
---[SHARED AND MENU] Resumes the given coroutine and passes the given vararg to either the function arguments or the [coroutine.yield](https://wiki.facepunch.com/gmod/coroutine.yield) that is inside that function and returns whatever yield is called with the next time or by the final return in the function.
1919
---
2020
---[(View on wiki)](https://wiki.facepunch.com/gmod/coroutine.resume)
2121
---@param coroutine thread Coroutine to resume.

__tests__/test-data/offline-sites/gmod-wiki/panel-slider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const apiDefinition =
4141
---
4242
---
4343
--- A simple slider featuring an numeric display.
44-
--- Creates a slider atop a DFrame which prints its value as it's being dragged.
44+
---
4545
---@deprecated Panel:SetActionFunction and Panel:PostMessage. Use DNumSlider instead.
4646
---@class Slider : Panel
4747
local Slider = {}\n\n`;

__tests__/test-data/offline-sites/gmod-wiki/struct-ang-pos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const json = {
1414
type: 'struct',
1515
name: 'AngPos',
1616
address: 'AngPos',
17-
description: 'Table used by various functions, such as Entity:GetAttachment.',
17+
description: 'Table used by various functions, such as [Entity:GetAttachment](https://wiki.facepunch.com/gmod/Entity:GetAttachment).',
1818
realm: 'Shared',
1919
fields: [
2020
{

__tests__/test-data/offline-sites/gmod-wiki/struct-custom-entity-fields.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ export const apiDefinition =
5050
`---
5151
--- Information about custom fields **all** entities can have.
5252
---
53-
--- See also Structures/ENT
53+
--- See also [Structures/ENT](https://wiki.facepunch.com/gmod/Structures/ENT)
5454
---
5555
---@class Custom_Entity_Fields
5656
local Custom_Entity_Fields = {}
5757
58-
---\`Serverside\`, Sandbox and Sandbox derived only. Called by the Drive property to override the default drive type, which is \`drive_sandbox\`.
58+
---\`Serverside\`, Sandbox and Sandbox derived only.
59+
---
60+
--- Called by the Drive property to override the default drive type, which is \`drive_sandbox\`.
5961
---@type function
6062
Custom_Entity_Fields.GetEntityDriveMode = nil
6163
@@ -79,15 +81,23 @@ Custom_Entity_Fields.PreEntityCopy = nil
7981
---@type function
8082
Custom_Entity_Fields.OnDuplicated = nil
8183
82-
---\`Shared\`, Sandbox or Sandbox derived only. If set to \`true\`, physgun will not be able to pick this entity up. This can also be set from map, see Sandbox Specific Mapping
84+
---\`Shared\`, Sandbox or Sandbox derived only.
85+
---
86+
--- If set to \`true\`, physgun will not be able to pick this entity up. This can also be set from map, see Sandbox Specific Mapping
8387
---@type boolean
8488
Custom_Entity_Fields.PhysgunDisabled = nil
8589
86-
---\`Shared\`, Sandbox or Sandbox derived only. Called from GM:PhysgunPickup, overrides \`PhysgunDisabled\`
90+
---\`Shared\`, Sandbox or Sandbox derived only.
91+
---
92+
--- Called from GM:PhysgunPickup, overrides \`PhysgunDisabled\`
8793
---@type function
8894
Custom_Entity_Fields.PhysgunPickup = nil
8995
90-
---\`Shared\`, Sandbox or Sandbox derived only. Controls which tools **and** properties can be used on this entity. Format is a list of strings where each string is the tool or property classname. This can also be set from map, see Sandbox Specific Mapping
96+
---\`Shared\`, Sandbox or Sandbox derived only.
97+
---
98+
--- Controls which tools **and** properties can be used on this entity. Format is a list of strings where each string is the tool or property classname.
99+
---
100+
--- This can also be set from map, see Sandbox Specific Mapping
91101
---@type table
92102
Custom_Entity_Fields.m_tblToolsAllowed = nil
93103

__tests__/utils/string.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ describe('putCommentBeforeEachLine', () => {
3232
['hello\r\nworld', '--- hello\n--- world'],
3333
['hello\n\nworld', '--- hello\n---\n--- world'],
3434
['hello\r\n\r\nworld', '--- hello\n---\n--- world'],
35-
['hello\n\n\n\nworld', '--- hello\n---\n---\n---\n--- world'],
36-
['hello\r\n\r\n\r\n\r\nworld', '--- hello\n---\n---\n---\n--- world'],
35+
['hello\n\n\n\nworld', '--- hello\n---\n--- world'],
36+
['hello\r\n\r\n\r\n\r\nworld', '--- hello\n---\n--- world'],
3737
])('should put a comment before each line', (input, expected, skipFirstLine = false) => {
3838
expect(putCommentBeforeEachLine(input, skipFirstLine)).toBe(expected);
3939
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function handleCallbackInDescription($: CheerioAPI, e: AnyNode): [string?, Funct
188188
callback.arguments.push(<FunctionArgument> {
189189
name: $el.attr('name')!,
190190
type: $el.attr('type')!,
191-
default: $el.attr('default')!,
191+
default: $el.attr('default'),
192192
description: $el.text()
193193
});
194194
}
@@ -197,7 +197,7 @@ function handleCallbackInDescription($: CheerioAPI, e: AnyNode): [string?, Funct
197197
callback.returns.push(<FunctionReturn> {
198198
name: $el.attr('name')!,
199199
type: $el.attr('type')!,
200-
default: $el.attr('default')!,
200+
default: $el.attr('default'),
201201
description: $el.text()
202202
});
203203
}

0 commit comments

Comments
 (0)