Skip to content

Commit

Permalink
COMDOX-345: Created test function
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-matthews committed Sep 5, 2023
1 parent 7de7c09 commit 4ddb7fb
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions .github/scripts/test-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
// Documentation for the actions/github-script:
// https://github.com/actions/github-script#run-a-separate-file

module.exports = async ({ testMetadata }) => {

console.log('\x1b[35m ==== FRONTMATTER REPORT - STARTING ==================== \x1b[0m');
console.info('\x1b[36m [cmd + click] on the file path to open \x1b[0m');

testMetadata.forEach(file => {
if (!file.description || !file.keywords || !file.title) {
console.log('\n\x1b[41mFail\x1b[0m - ' + file.fileAbsolutePath + ': ');
if (!file.title) console.error('\x1b[33m\tMissing Title \x1b[0m');
if (!file.description) console.error('\x1b[33m\tMissing Description \x1b[0m');
if (!file.keywords) console.warn('\x1b[33m\tMissing Keywords \x1b[0m');
} else {
console.log('\x1b[42mPass\x1b[0m - ' + file.fileAbsolutePath);
}
});

console.log('\x1b[35m ==== FRONTMATTER REPORT - FINISHED ==================== \x1b[0m');
function testMetadata(){
forEach(file => {
if (!file.description || !file.keywords || !file.title) {
console.log('\n\x1b[41mFail\x1b[0m - ' + file.fileAbsolutePath + ': ');
if (!file.title) console.error('\x1b[33m\tMissing Title \x1b[0m');
if (!file.description) console.error('\x1b[33m\tMissing Description \x1b[0m');
if (!file.keywords) console.warn('\x1b[33m\tMissing Keywords \x1b[0m');
} else {
console.log('\x1b[42mPass\x1b[0m - ' + file.fileAbsolutePath);
}
});

console.log('\x1b[35m ==== FRONTMATTER REPORT - FINISHED ==================== \x1b[0m');
}

}
module.exports = testMetadata;

0 comments on commit 4ddb7fb

Please sign in to comment.