Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion apps/desktop/src/app/DesktopPreReadyPlatform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import { beforeEach, vi } from "vite-plus/test";
import { afterEach, beforeEach, vi } from "vite-plus/test";

const { appendSwitchMock, getSwitchValueMock, hasSwitchMock, registerSchemesMock } = vi.hoisted(
() => ({
Expand Down Expand Up @@ -37,6 +37,10 @@ describe("DesktopPreReadyPlatform", () => {
registerSchemesMock.mockReset();
});

afterEach(() => {
vi.unstubAllEnvs();
});

it("reads an explicit Electron command-line switch value", () => {
const value = DesktopPreReadyPlatform.readCommandLineSwitchValue(
{
Expand Down Expand Up @@ -78,6 +82,23 @@ describe("DesktopPreReadyPlatform", () => {
assert.isNull(value);
});

it.effect("appends the packaged Linux window class before Electron is ready", () =>
Effect.gen(function* () {
vi.stubEnv("VITE_DEV_SERVER_URL", "");
hasSwitchMock.mockReturnValue(false);

const preReadyLayer = DesktopPreReadyPlatform.layer.pipe(
Layer.provide(Layer.succeed(HostProcessPlatform, "linux")),
);
const options = yield* Effect.gen(function* () {
return yield* DesktopPreReadyPlatform.DesktopPreReadyElectronOptions;
}).pipe(Effect.provide(preReadyLayer));

assert.equal(options.linux?.linuxWmClass, "t3code");
assert.deepEqual(appendSwitchMock.mock.calls[0], ["class", "t3code"]);
}),
);

it.effect(
"acquires a synchronous pre-ready layer before an asynchronous Clerk-shaped layer",
() =>
Expand Down
Loading