-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9d1d50
commit c2e6a1f
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
...ledger-live-desktop/src/newArch/WalletSync/__tests__/manageSynchronizedInstances.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import "@testing-library/jest-dom"; | ||
import { describe, it, expect, jest } from "@jest/globals"; | ||
|
||
import React from "react"; | ||
import { render, screen, waitFor } from "tests/testUtils"; | ||
import WalletSyncRow from "~/renderer/screens/settings/sections/General/WalletSync"; | ||
import { Flow, Step } from "~/renderer/reducers/walletSync"; | ||
|
||
const WalletSyncTestApp = () => ( | ||
<> | ||
<div id="modals"></div> | ||
<WalletSyncRow /> | ||
</> | ||
); | ||
|
||
jest.mock( | ||
"electron", | ||
() => ({ ipcRenderer: { on: jest.fn(), send: jest.fn(), invoke: jest.fn() } }), | ||
{ virtual: true }, | ||
); | ||
|
||
describe("manageSynchronizedInstances", () => { | ||
it("should open drawer and display Wallet Sync ManageSynchronizedInstances flow and delete your instance", async () => { | ||
const { user } = render(<WalletSyncTestApp />, { | ||
initialState: { | ||
walletSync: { | ||
activated: true, | ||
flow: Flow.Activation, | ||
step: Step.CreateOrSynchronize, | ||
instances: [ | ||
{ | ||
id: "1", | ||
name: "macOS", | ||
typeOfDevice: "desktop", | ||
}, | ||
{ | ||
id: "2", | ||
name: "Ipone 15", | ||
typeOfDevice: "mobile", | ||
}, | ||
], | ||
}, | ||
}, | ||
}); | ||
|
||
//Open drawer | ||
const button = screen.getByRole("button", { name: "Manage" }); | ||
await user.click(button); | ||
|
||
const row = screen.getByTestId("walletSync-manage-instances"); | ||
|
||
await waitFor(() => expect(row).toBeDefined()); | ||
|
||
expect(screen.getByText("2 synchronized instances")).toBeDefined(); | ||
|
||
await user.click(row); | ||
|
||
//Manage Synch Instances Step | ||
|
||
await waitFor(() => expect(screen.getByText("Manage synchronized instances")).toBeDefined()); | ||
|
||
const instance = screen.getByTestId("walletSync-manage-instance-2"); | ||
expect(instance).toBeDefined(); | ||
|
||
await user.click(screen.getAllByText("Remove")[1]); | ||
|
||
//Need to fake device action | ||
}); | ||
}); |