Skip to content

Commit d8543e9

Browse files
committed
test(desktop): await startup milestones directly
1 parent f6a3b15 commit d8543e9

2 files changed

Lines changed: 1 addition & 43 deletions

File tree

‎apps/desktop/src/app/DesktopApp.test.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import * as Fiber from "effect/Fiber";
1111
import * as Option from "effect/Option";
1212
import * as Ref from "effect/Ref";
1313
import * as Stream from "effect/Stream";
14-
import * as TestClock from "effect/testing/TestClock";
1514
import { vi } from "vite-plus/test";
1615

1716
vi.mock("electron", () => ({}));
@@ -224,11 +223,7 @@ it.effect(
224223
Effect.forkScoped,
225224
);
226225
yield* Deferred.await(registrationStarted);
227-
yield* TestClock.adjust(0);
228-
assert.isTrue(
229-
yield* Deferred.isDone(windowStarted),
230-
"the window must start before registration completes",
231-
);
226+
yield* Deferred.await(windowStarted);
232227
assert.deepEqual(events, ["identity", "ready", "identity", "backend", "window"]);
233228
assert.isFalse(yield* Deferred.isDone(registrationStopped));
234229
yield* (yield* DesktopShutdown.DesktopShutdown).request;

‎apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts‎

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -339,43 +339,6 @@ describe("DesktopLinuxUrlHandler", () => {
339339
});
340340
});
341341

342-
it.effect("releases a stalled MIME helper when the registration scope closes", () =>
343-
Effect.gen(function* () {
344-
const recorded = emptyRecording();
345-
const started = yield* Deferred.make<void>();
346-
const release = yield* Deferred.make<void>();
347-
const stopped = yield* Deferred.make<void>();
348-
const processSpawner = ChildProcessSpawner.make((command) => {
349-
if (!ChildProcess.isStandardCommand(command))
350-
return Effect.die("expected a single command");
351-
recorded.commands.push({ command: command.command, args: command.args });
352-
return Effect.acquireRelease(
353-
Effect.succeed(
354-
ChildProcessSpawner.makeHandle({
355-
...mockProcess(0),
356-
exitCode: Deferred.succeed(started, undefined).pipe(
357-
Effect.andThen(Deferred.await(release)),
358-
Effect.as(ChildProcessSpawner.ExitCode(0)),
359-
),
360-
}),
361-
),
362-
() => Deferred.succeed(stopped, undefined),
363-
);
364-
});
365-
yield* Effect.scoped(
366-
runRegister(recorded, { processSpawner }).pipe(
367-
Effect.forkScoped,
368-
Effect.andThen(Deferred.await(started)),
369-
),
370-
);
371-
assert.isTrue(yield* Deferred.isDone(stopped));
372-
assert.deepEqual(
373-
recorded.commands.map(({ command }) => command),
374-
["update-desktop-database"],
375-
);
376-
}),
377-
);
378-
379342
it.effect("never fails startup when registration cannot complete", () => {
380343
const desktopDatabaseFailed = emptyRecording();
381344
const xdgMimeFailed = emptyRecording();

0 commit comments

Comments
 (0)