diff --git a/src/app/lib/ledger.ts b/src/app/lib/ledger.ts index 567bd1303f..3b9b5e4e4f 100644 --- a/src/app/lib/ledger.ts +++ b/src/app/lib/ledger.ts @@ -19,8 +19,13 @@ export async function canAccessNavigatorUsb(): Promise { } export async function canAccessBle(): Promise { - // Returns always true on web - const isSupportedOnMobile = await BleTransport.isEnabled() + let isSupportedOnMobile = false + try { + // Returns always true on web + isSupportedOnMobile = await BleTransport.isEnabled() + } catch (ex) { + /* ignore */ + } // Scan depends on requestLEScan method, which is not available on the web(feature flag) const isSupportedOnDesktop = !!navigator?.bluetooth?.requestLEScan diff --git a/src/app/pages/OpenWalletPage/Features/FromLedger/__tests__/__snapshots__/index.test.tsx.snap b/src/app/pages/OpenWalletPage/Features/FromLedger/__tests__/__snapshots__/index.test.tsx.snap index e1fb6fbd6d..cf77e416f0 100644 --- a/src/app/pages/OpenWalletPage/Features/FromLedger/__tests__/__snapshots__/index.test.tsx.snap +++ b/src/app/pages/OpenWalletPage/Features/FromLedger/__tests__/__snapshots__/index.test.tsx.snap @@ -65,75 +65,6 @@ exports[` should render component 1`] = ` text-align: center; } -.c6 { - display: inline-block; - box-sizing: border-box; - cursor: pointer; - font: inherit; - -webkit-text-decoration: none; - text-decoration: none; - margin: 0; - background: transparent; - overflow: visible; - text-transform: none; - border: 2px solid #7D4CDB; - border-radius: 18px; - color: #444444; - padding: 4px 22px; - font-size: 18px; - line-height: 24px; - background-color: #7D4CDB; - color: #f8f8f8; - border-radius: 18px; - -webkit-transition-property: color,background-color,border-color,box-shadow; - transition-property: color,background-color,border-color,box-shadow; - -webkit-transition-duration: 0.1s; - transition-duration: 0.1s; - -webkit-transition-timing-function: ease-in-out; - transition-timing-function: ease-in-out; -} - -.c6:hover { - box-shadow: 0px 0px 0px 2px #7D4CDB; -} - -.c6:focus { - outline: none; - box-shadow: 0 0 2px 2px #6FFFB0; -} - -.c6:focus > circle, -.c6:focus > ellipse, -.c6:focus > line, -.c6:focus > path, -.c6:focus > polygon, -.c6:focus > polyline, -.c6:focus > rect { - outline: none; - box-shadow: 0 0 2px 2px #6FFFB0; -} - -.c6:focus::-moz-focus-inner { - border: 0; -} - -.c6:focus:not(:focus-visible) { - outline: none; - box-shadow: none; -} - -.c6:focus:not(:focus-visible) > circle,.c6:focus:not(:focus-visible) > ellipse, -.c6:focus:not(:focus-visible) > line,.c6:focus:not(:focus-visible) > path, -.c6:focus:not(:focus-visible) > polygon,.c6:focus:not(:focus-visible) > polyline, -.c6:focus:not(:focus-visible) > rect { - outline: none; - box-shadow: none; -} - -.c6:focus:not(:focus-visible)::-moz-focus-inner { - border: 0; -} - .c3 { display: inline-block; box-sizing: border-box; @@ -305,19 +236,25 @@ exports[` should render component 1`] = ` class="c5" />
- + + + errors.bleTransportNotSupported
diff --git a/src/app/pages/OpenWalletPage/Features/FromLedger/__tests__/index.test.tsx b/src/app/pages/OpenWalletPage/Features/FromLedger/__tests__/index.test.tsx index 347f3cac52..834bc89e52 100644 --- a/src/app/pages/OpenWalletPage/Features/FromLedger/__tests__/index.test.tsx +++ b/src/app/pages/OpenWalletPage/Features/FromLedger/__tests__/index.test.tsx @@ -13,6 +13,17 @@ jest.mock('react-router-dom', () => ({ useNavigate: () => jest.fn(), })) +jest.mock('react-router-dom', () => ({ + ...jest.requireActual('react-router-dom'), + useNavigate: () => jest.fn(), +})) + +jest.mock('../../../../../lib/ledger', () => ({ + ...jest.requireActual('../../../../../lib/ledger'), + // Throws BLE not supported + canAccessBle: () => jest.fn().mockReturnValue(false), +})) + const renderComponent = () => render( @@ -29,6 +40,7 @@ describe('', () => { expect(container).toMatchSnapshot() expect(screen.getByText('errors.usbTransportNotSupported')).toBeInTheDocument() + expect(screen.getByText('errors.bleTransportNotSupported')).toBeInTheDocument() }) it('should render component with an ledger access button', async () => { diff --git a/src/app/state/importaccounts/saga.test.ts b/src/app/state/importaccounts/saga.test.ts index 7ea81491c7..dc3e3ad3e8 100644 --- a/src/app/state/importaccounts/saga.test.ts +++ b/src/app/state/importaccounts/saga.test.ts @@ -55,10 +55,10 @@ describe('importAccounts Sagas', () => { for (let i = 0; i < 3; i++) { bleDevices.push({ device: { - deviceId: 'XX:XX:XX:XX:XX:XX', - name: 'Nano X BXAX', + deviceId: `${i}${i}:${i}${i}:${i}${i}:${i}${i}:${i}${i}:${i}${i}`, + name: `Nano X ABC${i}`, }, - localName: 'Nano X BXAX', + localName: `Nano X ABC${i}`, rssi: -50, txPower: 100, })