Skip to content

Commit

Permalink
support(llm): added redirection to manage key screen
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrellard-ledger committed Aug 8, 2024
1 parent 7ba1acf commit 18e009b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { screen } from "@testing-library/react-native";
import { screen, waitFor } from "@testing-library/react-native";
import { render } from "@tests/test-renderer";
import { WalletSyncSettingsNavigator } from "./shared";
import { State } from "~/reducers/types";
Expand Down Expand Up @@ -120,4 +120,31 @@ describe("ManageInstances", () => {
const myInstance = screen.getByTestId("walletSync-manage-instance-2");
expect(myInstance).toBeDefined();
});
it("Should redirect to the Manage Key screen", async () => {
const { user } = render(<WalletSyncSettingsNavigator />, {
overrideInitialState: (state: State) => ({
...state,
settings: {
...state.settings,
readOnlyModeEnabled: false,
overriddenFeatureFlags: { llmWalletSync: { enabled: true } },
},
trustchain: {
...state.trustchain,
trustchain,
memberCredentials: {
privatekey: "privatekey",
pubkey: "currentInstance",
},
},
}),
});

await user.press(await screen.findByText(/ledger sync/i));
await user.press(await screen.findByText(/Manage now/i));
await user.press(screen.getAllByText("Remove")[0]);
expect(screen.getByText(/You can’t remove the current instance/i)).toBeDefined();
await user.press(await screen.findByText(/Delete my encryption key/i));
await waitFor(() => screen.findByText(/Manage your key/i));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { useManageKeyDrawer } from "../ManageKey/useManageKeyDrawer";
import {
AnalyticsButton,
AnalyticsPage,
useWalletSyncAnalytics,
} from "../../hooks/useWalletSyncAnalytics";
useLedgerSyncAnalytics,
} from "../../hooks/useLedgerSyncAnalytics";

const ManageInstancesDrawer = ({
isDrawerVisible,
Expand All @@ -26,7 +26,7 @@ const ManageInstancesDrawer = ({
}: HookResult) => {
const { error, isError, isLoading, data } = memberHook;
const manageKeyHook = useManageKeyDrawer();
const { onClickTrack } = useWalletSyncAnalytics();
const { onClickTrack } = useLedgerSyncAnalytics();

const goToManageBackup = useCallback(() => {
handleClose();
Expand Down

0 comments on commit 18e009b

Please sign in to comment.