-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle zip files ending with ' .'
- Loading branch information
Showing
2 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,30 @@ | ||
import { hasMarkdownFileName } from './checks'; | ||
import { hasMarkdownFileName, isPotentialZipFile } from './checks'; | ||
|
||
const FILE_MD = 'abc.md'; | ||
const FILE_TXT = 'def.txt'; | ||
const FILE_MD_UPPER = 'cool.MD'; | ||
|
||
const NO_EXTENSION = 'file'; | ||
const ENDS_WITH_PERIOD = 'file.'; | ||
const HAS_EXTENSION_ZIP = 'file.zip'; | ||
const HAS_EXTENSION_TXT = 'file.txt'; | ||
const HAS_EXTENSION_TAR_GZ = 'file.tar.gz'; | ||
const ENDS_WITH_DOUBLE_PERIOD = 'file..'; | ||
|
||
test('hasMarkdownFileName returns true', () => { | ||
expect(hasMarkdownFileName(['abc.md', 'def.txt'])).toBe(true); | ||
expect(hasMarkdownFileName(['cool.MD'])).toBe(true); | ||
expect(hasMarkdownFileName([FILE_MD, FILE_TXT])).toBe(true); | ||
expect(hasMarkdownFileName([FILE_MD_UPPER])).toBe(true); | ||
}); | ||
|
||
test('hasMarkdownFileName returns false', () => { | ||
expect(hasMarkdownFileName(['abc.txt', 'def.txt'])).toBe(false); | ||
expect(hasMarkdownFileName([FILE_TXT, FILE_TXT])).toBe(false); | ||
}); | ||
|
||
test('isPotentialZipFile identifies potential zip files', () => { | ||
expect(isPotentialZipFile(NO_EXTENSION)).toBe(true); | ||
expect(isPotentialZipFile(ENDS_WITH_PERIOD)).toBe(true); | ||
expect(isPotentialZipFile(HAS_EXTENSION_ZIP)).toBe(false); | ||
expect(isPotentialZipFile(HAS_EXTENSION_TXT)).toBe(false); | ||
expect(isPotentialZipFile(HAS_EXTENSION_TAR_GZ)).toBe(false); | ||
expect(isPotentialZipFile(ENDS_WITH_DOUBLE_PERIOD)).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters