From c73138a046b99a893dc11422daecfda52cd97067 Mon Sep 17 00:00:00 2001 From: Oliver Schwendener Date: Mon, 4 Mar 2024 13:00:54 +0100 Subject: [PATCH] Use more accurate method name --- src/main/Core/ImageGenerator/FileIconExtractor.ts | 2 +- .../Core/ImageGenerator/FileImageGenerator.test.ts | 12 ++++++------ src/main/Core/ImageGenerator/FileImageGenerator.ts | 2 +- .../Core/ImageGenerator/GenericFileIconExtractor.ts | 2 +- .../ImageGenerator/MacOsApplicationIconExtractor.ts | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/Core/ImageGenerator/FileIconExtractor.ts b/src/main/Core/ImageGenerator/FileIconExtractor.ts index e72e4e056..8fd038c13 100644 --- a/src/main/Core/ImageGenerator/FileIconExtractor.ts +++ b/src/main/Core/ImageGenerator/FileIconExtractor.ts @@ -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; } diff --git a/src/main/Core/ImageGenerator/FileImageGenerator.test.ts b/src/main/Core/ImageGenerator/FileImageGenerator.test.ts index 997e14b57..8f7c22ecb 100644 --- a/src/main/Core/ImageGenerator/FileImageGenerator.test.ts +++ b/src/main/Core/ImageGenerator/FileImageGenerator.test.ts @@ -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 () => { url: "test url 1" }, }, { - validate: () => false, + machtes: () => false, extractFileIcon: async () => { url: "test url 2" }, }, { - validate: () => true, + machtes: () => true, extractFileIcon: async () => { url: "test url 3" }, }, ]); @@ -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 () => { url: "test url 1" }, }, { - validate: () => false, + machtes: () => false, extractFileIcon: async () => { url: "test url 2" }, }, { - validate: () => false, + machtes: () => false, extractFileIcon: async () => { url: "test url 3" }, }, ]); diff --git a/src/main/Core/ImageGenerator/FileImageGenerator.ts b/src/main/Core/ImageGenerator/FileImageGenerator.ts index b59831233..24bc4b451 100644 --- a/src/main/Core/ImageGenerator/FileImageGenerator.ts +++ b/src/main/Core/ImageGenerator/FileImageGenerator.ts @@ -7,7 +7,7 @@ export class FileImageGenerator implements FileImageGeneratorInterface { public async getImage(filePath: string): Promise { for (const fileIconExtractor of this.fileIconExtractors) { - if (fileIconExtractor.validate(filePath)) { + if (fileIconExtractor.machtes(filePath)) { return await fileIconExtractor.extractFileIcon(filePath); } } diff --git a/src/main/Core/ImageGenerator/GenericFileIconExtractor.ts b/src/main/Core/ImageGenerator/GenericFileIconExtractor.ts index 99d09c4d6..5e6664ff5 100644 --- a/src/main/Core/ImageGenerator/GenericFileIconExtractor.ts +++ b/src/main/Core/ImageGenerator/GenericFileIconExtractor.ts @@ -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; } diff --git a/src/main/Core/ImageGenerator/MacOsApplicationIconExtractor.ts b/src/main/Core/ImageGenerator/MacOsApplicationIconExtractor.ts index d18958bff..06918b259 100644 --- a/src/main/Core/ImageGenerator/MacOsApplicationIconExtractor.ts +++ b/src/main/Core/ImageGenerator/MacOsApplicationIconExtractor.ts @@ -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"); }