-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from UmbrellaDocs/incorrect-md-fix
Incorrect md fix
- Loading branch information
Showing
12 changed files
with
311 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
test/fixtures/asciidoc/hyperlinks/asciidoc-hyperlinks.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { expect, test } from 'vitest' | ||
import { linkspector } from './linkspector.js' | ||
|
||
let cmd = { | ||
json: true, | ||
} | ||
|
||
test('linkspector should check hyperlinks in AsciiDoc files', async () => { | ||
let hasErrorLinks = false | ||
let currentFile = '' // Variable to store the current file name | ||
let results = [] // Array to store the results if json is true | ||
|
||
for await (const { file, result } of linkspector( | ||
'./test/fixtures/asciidoc/hyperlinks/hyperlinksTest.yml', | ||
cmd | ||
)) { | ||
currentFile = file | ||
for (const linkStatusObj of result) { | ||
if (cmd.json) { | ||
results.push({ | ||
file: currentFile, | ||
link: linkStatusObj.link, | ||
status_code: linkStatusObj.status_code, | ||
line_number: linkStatusObj.line_number, | ||
position: linkStatusObj.position, | ||
status: linkStatusObj.status, | ||
error_message: linkStatusObj.error_message, | ||
}) | ||
} | ||
if (linkStatusObj.status === 'error') { | ||
hasErrorLinks = true | ||
} | ||
} | ||
} | ||
|
||
expect(hasErrorLinks).toBe(true) | ||
expect(results.length).toBe(4) | ||
expect(results[0].status).toBe('error') | ||
expect(results[1].status).toBe('alive') | ||
expect(results[2].status).toBe('error') | ||
expect(results[3].status).toBe('alive') | ||
}) |
Oops, something went wrong.