Skip to content

Commit

Permalink
[LEARN-7454] Ignora arquivos que não sejam markdown (#16)
Browse files Browse the repository at this point in the history
* chore: ignora arquivos que nao sao markdown

* chore: gera o dist
  • Loading branch information
AdrielBento authored Feb 2, 2023
1 parent 00b8c2e commit d76dfa6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
7 changes: 5 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9623,8 +9623,7 @@ async function validate(){
function getFiles() {
return process.env.INPUT_FILES
.split(' ')
.filter(file => !file.includes('.yml'))
.filter(file => !file.includes('.xml'))
.filter(isMarkdown)
.filter(file => !invalidFiles.includes(file))
.filter(isNumericPath)
}
Expand Down Expand Up @@ -9718,6 +9717,10 @@ function isNumericPath(path) {
return !isNaN(name)
}

function isMarkdown(path){
return path.includes('.md')
}

module.exports = validate

/***/ }),
Expand Down
8 changes: 8 additions & 0 deletions src/test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,12 @@ describe('Test quiz validator', () =>{
const result = await validate()
expect(result).toEqual(false)
})

test('must return false when no files is markdown', async () => {
const files = ['test.js', 'test.yml', 'test.html', 'test.md', 'metadados.md', '.cspell.json']
process.env.INPUT_FILES = files.concat(' ')

const result = await validate()
expect(result).toEqual(false)
})
})
7 changes: 5 additions & 2 deletions src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ async function validate(){
function getFiles() {
return process.env.INPUT_FILES
.split(' ')
.filter(file => !file.includes('.yml'))
.filter(file => !file.includes('.xml'))
.filter(isMarkdown)
.filter(file => !invalidFiles.includes(file))
.filter(isNumericPath)
}
Expand Down Expand Up @@ -156,4 +155,8 @@ function isNumericPath(path) {
return !isNaN(name)
}

function isMarkdown(path){
return path.includes('.md')
}

module.exports = validate

0 comments on commit d76dfa6

Please sign in to comment.