-
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.
feat(llm): fix missing mock for jest integrations tests
- Loading branch information
1 parent
d6ecc39
commit 4938d10
Showing
5 changed files
with
38 additions
and
20 deletions.
There are no files selected for viewing
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
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
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
38 changes: 22 additions & 16 deletions
38
...ive-mobile/src/newArch/features/Accounts/__integrations__/addAccount.integration.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 |
---|---|---|
@@ -1,39 +1,45 @@ | ||
import React from "react"; | ||
import { screen } from "@testing-library/react-native"; | ||
import { render } from "@tests/test-renderer"; | ||
import { render, act } from "@tests/test-renderer"; | ||
import { TestButtonPage } from "./shared"; | ||
import { State } from "~/reducers/types"; | ||
|
||
describe("AddAccount", () => { | ||
it("Should open select add account method drawer with Wallet Sync option", async () => { | ||
it("Should open select add account method drawer with Wallet Sync option and navigate to import with your Ledger", async () => { | ||
const { user } = render(<TestButtonPage />, { | ||
overrideInitialState: (state: State) => ({ | ||
...state, | ||
settings: { | ||
...state.settings, | ||
overriddenFeatureFlags: { llmWalletSync: { enabled: true } }, | ||
readOnlyModeEnabled: false, | ||
overriddenFeatureFlags: { llmWalletSync: { enabled: true } }, | ||
}, | ||
}), | ||
}); | ||
|
||
const addAssetButton = await screen.findByText(/Add asset/i); | ||
|
||
// Check if the add asset button is visible | ||
expect(addAssetButton).toBeVisible(); | ||
|
||
await expect(addAssetButton).toBeVisible(); | ||
// Open drawer | ||
await user.press(addAssetButton); | ||
expect(await screen.findByText(/Add another account/i)).toBeVisible(); | ||
expect(await screen.findByText(/Add with your Ledger/i)).toBeVisible(); | ||
expect(await screen.findByText(/Import via another Ledger Live app/i)).toBeVisible(); | ||
await act(async () => { | ||
await user.press(addAssetButton); | ||
}); | ||
// Wait for the drawer to open | ||
await expect(await screen.findByText(/add another account/i)); | ||
await expect(await screen.findByText(/add with your ledger/i)); | ||
await expect(await screen.findByText(/import via another ledger live app/i)); | ||
|
||
// On press add with your Ledger | ||
await user.press(screen.getByText(/Add with your Ledger/i)); | ||
expect(await screen.findByText(/Crypto asset/i)).toBeVisible(); | ||
// IT NEED A FIX ON SOME PACKAGES TO AVOID THE FOLLOWING ERROR : | ||
/** | ||
* SyntaxError: Cannot use import statement outside a module | ||
*/ | ||
// On press add with another ledger live app | ||
await act(async () => { | ||
await user.press(await screen.getByText(/add with your ledger/i)); | ||
}); | ||
await expect(await screen.findByText(/crypto asset/i)).toBeVisible(); | ||
|
||
// On click back | ||
await act(async () => { | ||
await user.press(await screen.findByTestId(/navigation-header-back-button/i)); | ||
}); | ||
await expect(addAssetButton).toBeVisible(); | ||
}); | ||
}); |
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