Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): device host checks show the error without a stack trace #29912

Mergedsaphid(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/29912/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 66 additions and 2 deletions.

x
0 of 2 viewed, 2 left
64 additions and 0 deletionsapps/web/src/components/settings/useHostConnectionChecks.browser.test.tsxAdded
View file
@@ -0,0 +1,64 @@
+import { DeviceHostUnavailableError, EnvironmentId } from "@t3tools/contracts";
+import * as Cause from "effect/Cause";
+import { AsyncResult } from "effect/reactivity";
+import { describe, expect, it, vi } from "vite-plus/test";
+​
+import { act, render } from "../../../test/render";
+​
+const state = vi.hoisted(() => ({ test: vi.fn() }));
+function setup() {
+ state.test.mockReset();
+}
+​
+vi.mock(import("../../state/use-atom-command"), async (original) => ({
+ ...(await original()),
+ useAtomCommand: (() => state.test) as never,
+}));
+vi.mock(import("../../state/session"), async (original) => ({
+ ...(await original()),
+ readEnvironmentScope: (() => true) as never,
+}));
+​
+import { useHostConnectionChecks } from "./useHostConnectionChecks";
+​
+const environmentId = EnvironmentId.make("environment-1");
+const targets = [{ environmentId, label: "This Mac", connected: true }];
+​
+function Harness({
+ onReady,
+}: {
+ onReady: (run: ReturnType<typeof useHostConnectionChecks>) => void;