| @@ -37,45 +37,22 @@ describe("DesktopPreReadyPlatform", () => { · 36 unmodified lines |
| 37 | 37 | registerSchemesMock.mockReset(); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | | − it("reads an explicit Electron command-line switch value", () => { |
| 41 | | − const value = DesktopPreReadyPlatform.readCommandLineSwitchValue( |
| 42 | | − { |
| 43 | | − hasSwitch: (switchName) => switchName === "password-store", |
| 44 | | − getSwitchValue: (switchName) => { |
| 45 | | − assert.equal(switchName, "password-store"); |
| 46 | | − return "basic"; |
| 47 | | − }, |
| 48 | | − }, |
| 49 | | − "password-store", |
| 40 | + it.effect("preserves an explicit Linux password-store switch", () => { |
| 41 | + hasSwitchMock.mockImplementation((switchName) => switchName === "password-store"); |
| 42 | + getSwitchValueMock.mockReturnValue(" basic "); |
| 43 | + |
| 44 | + return Effect.gen(function* () { |
| 45 | + const options = yield* DesktopPreReadyPlatform.DesktopPreReadyElectronOptions; |
| 46 | + |
| 47 | + assert.equal(options.linuxPasswordStoreCommandLine, "basic"); |
| 48 | + assert.isFalse(appendSwitchMock.mock.calls.some(([name]) => name === "password-store")); |
| 49 | + }).pipe( |
| 50 | + Effect.provide( |
| 51 | + DesktopPreReadyPlatform.layer.pipe( |
| 52 | + Layer.provide(Layer.succeed(HostProcessPlatform, "linux")), |
| 53 | + ), |
| 54 | + ), |
| 50 | 55 | ); |
| 51 | | − |
| 52 | | − assert.equal(value, "basic"); |
| 53 | | − }); |
| 54 | | − |
| 55 | | − it("treats valueless Electron command-line switches as absent", () => { |
| 56 | | − const value = DesktopPreReadyPlatform.readCommandLineSwitchValue( |
| 57 | | − { |
| 58 | | − hasSwitch: () => true, |
| 59 | | − getSwitchValue: () => "", |
| 60 | | − }, |
| 61 | | − "password-store", |
| 62 | | − ); |
| 63 | | − |
| 64 | | − assert.isNull(value); |
| 65 | | − }); |
| 66 | | − |
| 67 | | − it("returns null for missing Electron command-line switches", () => { |
| 68 | | − const value = DesktopPreReadyPlatform.readCommandLineSwitchValue( |
| 69 | | − { |
| 70 | | − hasSwitch: () => false, |
| 71 | | − getSwitchValue: () => { |
| 72 | | − throw new Error("Unexpected switch value read."); |
| 73 | | − }, |
| 74 | | − }, |
| 75 | | − "password-store", |
| 76 | | − ); |
| 77 | | − |
| 78 | | − assert.isNull(value); |
| 79 | 56 | }); |
| 80 | 57 | |
| 81 | 58 | it.effect( |