| 1 | import { sign as signApplication, type SignOptions } from "@electron/osx-sign"; |
| 2 | import { expect, it, vi } from "vite-plus/test"; |
| 3 | |
| 4 | import sign from "./sign-macos.ts"; |
| 5 | |
| 6 | vi.mock("@electron/osx-sign", () => ({ sign: vi.fn() })); |
| 7 | |
| 8 | it("batches codesign calls without changing existing signing options", async () => { |
| 9 | const options = { |
| 10 | app: "/tmp/T3 Code.app", |
| 11 | identity: "Developer ID Application: T3 Tools, Inc.", |
| 12 | keychain: "/tmp/t3code.keychain", |
| 13 | provisioningProfile: "/tmp/t3code.provisionprofile", |
| 14 | optionsForFile: () => ({ |
| 15 | entitlements: "/tmp/t3code.entitlements.plist", |
| 16 | hardenedRuntime: true, |
| 17 | }), |
| 18 | } satisfies SignOptions; |
| 19 | |
| 20 | await sign(options); |
| 21 | |
| 22 | expect(signApplication).toHaveBeenCalledExactlyOnceWith({ |
| 23 | ...options, |
| 24 | batchCodesignCalls: true, |
| 25 | }); |
| 26 | }); |