Skip to content

Commit

Permalink
Use more accurate method name
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschwendener committed Mar 4, 2024
1 parent dec4737 commit c73138a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/Core/ImageGenerator/FileIconExtractor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Image } from "@common/Core/Image";

export interface FileIconExtractor {
validate: (filePath: string) => boolean;
machtes: (filePath: string) => boolean;
extractFileIcon: (filePath: string) => Promise<Image>;
}
12 changes: 6 additions & 6 deletions src/main/Core/ImageGenerator/FileImageGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ describe(FileImageGenerator, () => {
it("should return the extracted image from the first matching file icon extractor", async () => {
const fileImageGenerator = new FileImageGenerator([
{
validate: () => false,
machtes: () => false,
extractFileIcon: async () => <Image>{ url: "test url 1" },
},
{
validate: () => false,
machtes: () => false,
extractFileIcon: async () => <Image>{ url: "test url 2" },
},
{
validate: () => true,
machtes: () => true,
extractFileIcon: async () => <Image>{ url: "test url 3" },
},
]);
Expand All @@ -25,15 +25,15 @@ describe(FileImageGenerator, () => {
it("should throw an error if all file icon extractors don't match the given file path", async () => {
const fileImageGenerator = new FileImageGenerator([
{
validate: () => false,
machtes: () => false,
extractFileIcon: async () => <Image>{ url: "test url 1" },
},
{
validate: () => false,
machtes: () => false,
extractFileIcon: async () => <Image>{ url: "test url 2" },
},
{
validate: () => false,
machtes: () => false,
extractFileIcon: async () => <Image>{ url: "test url 3" },
},
]);
Expand Down
2 changes: 1 addition & 1 deletion src/main/Core/ImageGenerator/FileImageGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class FileImageGenerator implements FileImageGeneratorInterface {

public async getImage(filePath: string): Promise<Image> {
for (const fileIconExtractor of this.fileIconExtractors) {
if (fileIconExtractor.validate(filePath)) {
if (fileIconExtractor.machtes(filePath)) {
return await fileIconExtractor.extractFileIcon(filePath);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/Core/ImageGenerator/GenericFileIconExtractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { FileIconExtractor } from "./FileIconExtractor";
export class GenericFileIconExtractor implements FileIconExtractor {
public constructor(private readonly app: App) {}

public validate() {
public machtes() {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class MacOsApplicationIconExtractor implements FileIconExtractor {
private readonly cacheFileNameGenerator: CacheFileNameGenerator,
) {}

public validate(filePath: string) {
public machtes(filePath: string) {
return filePath.endsWith(".app");
}

Expand Down

0 comments on commit c73138a

Please sign in to comment.