Skip to content

Commit

Permalink
coverage udpated
Browse files Browse the repository at this point in the history
  • Loading branch information
vishvamsinh28 committed Dec 4, 2024
1 parent 8d9221b commit f595339
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 1 addition & 4 deletions scripts/markdown/check-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ const docsFolderPath = path.resolve(__dirname, '../../markdown/docs');
const blogsFolderPath = path.resolve(__dirname, '../../markdown/blog');

async function main() {
if (!fs.access(docsFolderPath) || !fs.access(blogsFolderPath)) {
throw new Error('Invalid folder paths provided');
}
try {
await Promise.all([
checkMarkdownFiles(docsFolderPath, validateDocs),
Expand All @@ -163,4 +160,4 @@ if (require.main === module) {
main();
}

module.exports = { validateBlogs, validateDocs, checkMarkdownFiles, main }
module.exports = { validateBlogs, validateDocs, checkMarkdownFiles, main, isValidURL }
10 changes: 10 additions & 0 deletions tests/markdown/check-markdown.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require('fs').promises;
const path = require('path');
const os = require('os');
const {
isValidURL,
main,
validateBlogs,
validateDocs,
Expand Down Expand Up @@ -137,4 +138,13 @@ describe('Frontmatter Validator', () => {
expect(mockConsoleError).not.toHaveBeenCalledWith()
});

it('should return true or false for URLs', () => {
expect(isValidURL('http://example.com')).toBe(true);
expect(isValidURL('https://www.example.com')).toBe(true);
expect(isValidURL('ftp://ftp.example.com')).toBe(true);
expect(isValidURL('invalid-url')).toBe(false);
expect(isValidURL('/path/to/file')).toBe(false);
expect(isValidURL('www.example.com')).toBe(false);
});

});

0 comments on commit f595339

Please sign in to comment.