Skip to content

Commit

Permalink
test: improve test coverage (#1435)
Browse files Browse the repository at this point in the history
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
  • Loading branch information
jackton1 and tj-actions-bot authored Aug 5, 2023
1 parent 6b028b6 commit 29022e8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,5 +421,30 @@ describe('utils test', () => {
'test/migrations/test.sql'
])
})

// Tests that getFilteredChangedFiles correctly filters files using ignore glob patterns
it('should filter files using ignore glob patterns', async () => {
const allDiffFiles = {
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
[ChangeTypeEnum.Deleted]: [],
[ChangeTypeEnum.Modified]: [
'assets/scripts/configure-minikube-linux.sh'
],
[ChangeTypeEnum.Renamed]: [],
[ChangeTypeEnum.TypeChanged]: [],
[ChangeTypeEnum.Unmerged]: [],
[ChangeTypeEnum.Unknown]: []
}
const filePatterns = [
'assets/scripts/**.sh',
'!assets/scripts/configure-minikube-linux.sh'
]
const filteredFiles = await getFilteredChangedFiles({
allDiffFiles,
filePatterns
})
expect(filteredFiles[ChangeTypeEnum.Modified]).toEqual([])
})
})
})

0 comments on commit 29022e8

Please sign in to comment.