Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): disable server update Button until connected #6204

Closedmaciekczech(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/6204/headopened View on GitHub

Showing 3 changed files with 108 additions and 7 deletions.

x
0 of 3 viewed, 3 left
88 additions and 4 deletionsapps/web/src/components/ServerUpdateAction.test.tsxModified
View file
@@ -1,4 +1,4 @@
-import type { ReactElement } from "react";
+import { Children, isValidElement, type ReactElement, type ReactNode } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import type { EnvironmentId } from "@t3tools/contracts";
import * as Cause from "effect/Cause";
@@ -6,6 +6,7 @@
import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
​
const testState = vi.hoisted(() => ({
+ connectionPhase: "connected",
updateServer: vi.fn(),
toast: vi.fn(),
}));
@@ -16,6 +17,12 @@
vi.mock("~/state/server", () => ({
serverEnvironment: { updateServer: Symbol("updateServer") },
}));
+vi.mock("~/state/presentation", () => ({
+ useEnvironmentPresentation: () => ({
+ isReady: true,
+ presentation: { connection: { phase: testState.connectionPhase } },
+ }),
+}));
vi.mock("~/state/use-atom-command", () => ({
useAtomCommand: () => testState.updateServer,
}));
@@ -24,18 +31,60 @@