forked from oliverschwendener/ueli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(WindowsApplicationIconExtractor): ignore case of file extension (o…
- Loading branch information
1 parent
8d183c6
commit 02356e1
Showing
2 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
src/main/Core/ImageGenerator/Windows/WindowsApplicationIconExtractor.test.ts
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { WindowsApplicationIconExtractor } from "./WindowsApplicationIconExtractor"; | ||
|
||
describe(WindowsApplicationIconExtractor, () => { | ||
describe(WindowsApplicationIconExtractor.prototype.matchesFilePath, () => { | ||
const testMatchesFilePath = ({ filePath, expected }: { filePath: string; expected: boolean }) => | ||
expect(new WindowsApplicationIconExtractor(null, null, null, "").matchesFilePath(filePath)).toBe(expected); | ||
|
||
it("should return true when file path ends with .lnk, .url, .appref-ms, .exe", () => { | ||
const filePaths = [ | ||
"file.lnk", | ||
"file.url", | ||
"file.appref-ms", | ||
"file.exe", | ||
"file.LNK", | ||
"file.URL", | ||
"file.APPREF-MS", | ||
"file.EXE", | ||
]; | ||
|
||
for (const filePath of filePaths) { | ||
testMatchesFilePath({ filePath, expected: true }); | ||
} | ||
}); | ||
|
||
it("should return false when file path ends with other file extensions", () => { | ||
const filePaths = [ | ||
"", | ||
" ", | ||
"file", | ||
"file.ln", | ||
"file.ex", | ||
"lnk", | ||
"exe", | ||
"file.txt", | ||
"file.doc", | ||
"file.docx", | ||
"file.pdf", | ||
"file.jpg", | ||
"file.png", | ||
]; | ||
|
||
for (const filePath of filePaths) { | ||
testMatchesFilePath({ filePath, expected: false }); | ||
} | ||
}); | ||
}); | ||
}); |
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