Skip to content

Commit 016786a

Browse files
committed
Remove unreachable workdir check in unzipIPA
1 parent 8721565 commit 016786a

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,17 +876,17 @@ class Applesign {
876876
}
877877
}
878878

879-
async unzipIPA(file: any, workdir: any): Promise<any> {
879+
async unzipIPA(file: string, workdir: string): Promise<void> {
880880
fchk(arguments, ["string", "string"]);
881-
if (!file || !workdir) {
882-
throw new Error("No output specified");
881+
if (!file) {
882+
throw new Error("No input file specified");
883883
}
884884
if (!workdir) {
885-
throw new Error("Invalid output directory");
885+
throw new Error("No output directory specified");
886886
}
887887
await this.cleanup();
888888
this.events.emit("message", "Unzipping " + file);
889-
return tools.unzip(file, workdir);
889+
await tools.unzip(file, workdir);
890890
}
891891

892892
/* Event Wrapper API with cb support */

lib/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
const version = "5.0.1";
1+
const version = "6.0.0";
22
export default version;

test/test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { spawn } from "node:child_process";
33
import * as path from "node:path";
44
import * as fs from "node:fs";
55
import { describe, it } from "mocha";
6+
import Applesign from "../index.js";
67

78
const mochaTimeout = 15000;
89
const developerCertificate = process.env.DEVCERT;
@@ -25,6 +26,26 @@ describe("API", () => {
2526
});
2627
*/
2728

29+
describe("API", () => {
30+
describe("unzipIPA", () => {
31+
it("should fail when the input file is missing", async () => {
32+
const applesign = new Applesign({});
33+
await assert.rejects(
34+
applesign.unzipIPA("", "tmp"),
35+
/No input file specified/,
36+
);
37+
});
38+
39+
it("should fail when the output directory is missing", async () => {
40+
const applesign = new Applesign({});
41+
await assert.rejects(
42+
applesign.unzipIPA("test.ipa", ""),
43+
/No output directory specified/,
44+
);
45+
});
46+
});
47+
});
48+
2849
describe("Commandline", () => {
2950
describe("dist/bin/applesign.js", () => {
3051
it("should fail when applesign cannot be executed", (done) => {

0 commit comments

Comments
 (0)