diff --git a/spec/factory.spec.ts b/spec/factory.spec.ts index 31dfaca..5d2fa8a 100644 --- a/spec/factory.spec.ts +++ b/spec/factory.spec.ts @@ -82,4 +82,25 @@ describe('createMachoFiles', () => { expect(expected.get(uuid)).toEqual(path); } }); + + describe("isFatOrMacho", () => { + it("should return true for fat file", async () => + expectAsync( + isFatOrMacho( + "spec/support/bugsplat-ios.app/Frameworks/bugsplat.framework/HockeySDKResources.bundle/Contents/MacOS/HockeySDKResources" + ) + ).toBeResolvedTo(true)); + + it("should return true for macho file", async () => + expectAsync( + isFatOrMacho( + "spec/support/bugsplat.app.dSYM/Contents/Resources/DWARF/bugsplat" + ) + ).toBeResolvedTo(true)); + + it("should return true for dylib file", async () => + expectAsync(isFatOrMacho("spec/support/libggcurl.dylib")).toBeResolvedTo( + true + )); + }); }); diff --git a/src/factory.ts b/src/factory.ts index 2675d76..67fcf15 100644 --- a/src/factory.ts +++ b/src/factory.ts @@ -93,6 +93,6 @@ async function getUniqueMachoFiles(machoFiles: Array): Promise { - return !extname(path) && (await MachoFile.isMacho(path) || await FatFile.isFat(path)); +export async function isFatOrMacho(path: string): Promise { + return (await MachoFile.isMacho(path) || await FatFile.isFat(path)); }