Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge pull request #6 from JLLeitschuh/feat/JLL/homoglyph_detector #6

Merged
merged 4 commits into from
Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add a homoglyph detector for gradle-wrapper.jar files
  • Loading branch information
JLLeitschuh committed Jan 13, 2020
commit ae0da6528c1657296bb769bed0f541ffb70b5046
Empty file.
3 changes: 2 additions & 1 deletion __tests__/find.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import * as find from '../src/find'
test('finds test data wrapper jars', async () => {
const repoRoot = path.resolve('.')
const wrapperJars = await find.findWrapperJars(repoRoot)
expect(wrapperJars.length).toBe(2)
expect(wrapperJars.length).toBe(3)
expect(wrapperJars).toContain('__tests__/data/valid/gradle-wrapper.jar')
expect(wrapperJars).toContain('__tests__/data/invalid/gradle-wrapper.jar')
expect(wrapperJars).toContain('__tests__/data/invalid/gradlе-wrapper.jar') // homoglyph
})
8 changes: 4 additions & 4 deletions __tests__/validate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import * as validate from '../src/validate'
test('validates wrapper jars', async () => {
const invalidWrapperJars = await validate.findInvalidWrapperJars(
path.resolve('.'),
2,
3,
false,
[]
)
expect(invalidWrapperJars.length).toBe(1)
expect(invalidWrapperJars.length).toBe(2)
expect(invalidWrapperJars[0]).toEqual(
new validate.InvalidWrapperJar(
'__tests__/data/invalid/gradle-wrapper.jar',
Expand All @@ -19,8 +19,8 @@ test('validates wrapper jars', async () => {

test('fails if not enough wrapper jars are found', async () => {
await expect(
validate.findInvalidWrapperJars(path.resolve('.'), 3, false, [])
validate.findInvalidWrapperJars(path.resolve('.'), 4, false, [])
).rejects.toThrowError(
'Expected to find at least 3 Gradle Wrapper JARs but got only 2'
'Expected to find at least 4 Gradle Wrapper JARs but got only 3'
)
})
Loading