Skip to content

Commit

Permalink
test: fix typing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ccharly committed Nov 15, 2024
1 parent c459d37 commit 401ee7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import ledgerService from '@ledgerhq/hw-app-eth/lib/services/ledger';
import type { DeviceModel } from "@ledgerhq/devices";

Check failure on line 2 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

`@ledgerhq/devices` type import should occur before import of `@ledgerhq/hw-app-eth/lib/services/ledger`

Check failure on line 2 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

'DeviceModel' is defined but never used

Check failure on line 2 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

Replace `"@ledgerhq/devices"` with `'@ledgerhq/devices'`

Check failure on line 2 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

"@ledgerhq/devices" is extraneous

Check failure on line 2 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

`@ledgerhq/devices` type import should occur before import of `@ledgerhq/hw-app-eth/lib/services/ledger`

Check failure on line 2 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

'DeviceModel' is defined but never used

Check failure on line 2 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

Replace `"@ledgerhq/devices"` with `'@ledgerhq/devices'`

Check failure on line 2 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

"@ledgerhq/devices" is extraneous
import Transport from '@ledgerhq/hw-transport';

import { MetaMaskLedgerHwAppEth } from './ledger-hw-app';
import { LedgerMobileBridge } from './ledger-mobile-bridge';
import { LedgerTransportMiddleware } from './ledger-transport-middleware';

type MockDeviceModel = {
id: string,

Check failure on line 10 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

Replace `,` with `;`

Check failure on line 10 in packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

Replace `,` with `;`
};

const DEVICE_ID = 'DEVICE_ID';

describe('LedgerMobileBridge', function () {
Expand All @@ -25,7 +30,7 @@ describe('LedgerMobileBridge', function () {
};

const mockTransport = {
deviceModel: {} || null,
deviceModel: { id: '' } as MockDeviceModel, // Will be set by `beforeEach`
send: jest.fn(),
close: jest.fn(),
decorateAppAPIMethods: jest.fn(),
Expand Down Expand Up @@ -220,8 +225,8 @@ describe('LedgerMobileBridge', function () {
);
});

it('throws error when transport.deviceMode is not set', async function () {
mockTransport.deviceModel = null;
it('throws error when transport.deviceModel is not set', async function () {
mockTransport.deviceModel = null as unknown as MockDeviceModel;
await expect(
bridge.updateTransportMethod(mockTransport as unknown as Transport),
).rejects.toThrow(
Expand Down
2 changes: 1 addition & 1 deletion packages/keyring-snap-bridge/src/SnapKeyring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ describe('SnapKeyring', () => {

it('fails when the EthMethod is not supported after update', async () => {
// Update first account to remove `EthMethod.PersonalSign`
let updatedMethods = Object.values(EthMethod).filter(
let updatedMethods: EthMethod[] = Object.values(EthMethod).filter(
(method) => method !== EthMethod.PersonalSign,
);
expect(
Expand Down

0 comments on commit 401ee7d

Please sign in to comment.