Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(connect): repair drifted managed links #11911

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

Showing 6 changed files with 219 additions and 0 deletions (loading 5).

x
0 of 6 viewed, 6 left
219 additions and 0 deletionsapps/web/src/cloud/useCloudLinkController.test.tsxAdded
View file
@@ -0,0 +1,219 @@
+import type { Discovery } from "@t3tools/client-runtime/relay";
+import { EnvironmentId } from "@t3tools/contracts";
+import * as Option from "effect/Option";
+import * as Cause from "effect/Cause";
+import { AsyncResult } from "effect/unstable/reactivity";
+import { act, useLayoutEffect } from "react";
+import { create, type ReactTestRenderer } from "react-test-renderer";
+import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
+​
+const mocks = vi.hoisted(() => ({
+ getToken: vi.fn(),
+ link: vi.fn(),
+ unlink: vi.fn(),
+ preferences: vi.fn(),
+ refresh: vi.fn(),
+ refreshRelay: vi.fn(),
+ toast: vi.fn(),
+}));
+​
+vi.mock("@clerk/react", () => ({
+ useAuth: () => ({ getToken: mocks.getToken, isSignedIn: true }),
+}));
+vi.mock("../components/ui/toast", () => ({ toastManager: { add: mocks.toast } }));
+vi.mock("../state/relay", () => ({ relayEnvironmentDiscovery: { refresh: mocks.refreshRelay } }));
+vi.mock("../state/use-atom-command", () => ({ useAtomCommand: (command: unknown) => command }));
+vi.mock("./linkEnvironmentAtoms", () => ({
+ linkPrimaryEnvironment: mocks.link,
+ unlinkPrimaryEnvironment: mocks.unlink,
+ updatePrimaryEnvironmentPreferences: mocks.preferences,
+}));