Skip to content

Commit dd0747c

Browse files
committed
tests: Fix saga tests
1 parent f2f6bca commit dd0747c

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/app/lib/ledger.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe('Ledger Library', () => {
113113
it('Should fail without USB transport', () => {
114114
const signer = new LedgerSigner({
115115
type: WalletType.Ledger,
116-
path: [44, 474, 0, 0, 0],
116+
path: Ledger.mustGetPath(DerivationPathTypeAdr8, 0),
117117
publicKey: '00',
118118
} as Wallet)
119119

@@ -141,7 +141,7 @@ describe('Ledger Library', () => {
141141

142142
const signer = new LedgerSigner({
143143
type: WalletType.Ledger,
144-
path: [44, 474, 0, 0, 0],
144+
path: Ledger.mustGetPath(DerivationPathTypeAdr8, 0),
145145
publicKey: '00',
146146
} as Wallet)
147147

@@ -157,7 +157,7 @@ describe('Ledger Library', () => {
157157

158158
const signer = new LedgerSigner({
159159
type: WalletType.Ledger,
160-
path: [44, 474, 0, 0, 0],
160+
path: Ledger.mustGetPath(DerivationPathTypeAdr8, 0),
161161
publicKey: '00',
162162
} as Wallet)
163163

src/app/state/ledger/saga.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { addressToPublicKey } from 'app/lib/helpers'
99
import { LedgerStep } from './types'
1010
import { WalletErrors } from 'types/errors'
1111
import { OasisTransaction } from 'app/lib/transaction'
12+
import { selectDerivationPathType } from './selectors'
1213

1314
describe('Ledger Sagas', () => {
1415
describe('enumerateAccounts', () => {
@@ -24,6 +25,7 @@ describe('Ledger Sagas', () => {
2425
[matchers.call.fn(TransportWebUSB.create), { close: () => {} }],
2526
[matchers.call.fn(Ledger.enumerateAccounts), [validAccount]],
2627
[matchers.call.fn(getBalance), {}],
28+
[matchers.select.selector(selectDerivationPathType), DerivationPathTypeAdr8],
2729
])
2830
.dispatch(ledgerActions.enumerateAccounts(DerivationPathTypeAdr8))
2931
.put(ledgerActions.setStep(LedgerStep.Done))
@@ -43,6 +45,7 @@ describe('Ledger Sagas', () => {
4345
[matchers.call.fn(TransportWebUSB.create), { close: () => {} }],
4446
[matchers.call.fn(Ledger.enumerateAccounts), [validAccount]],
4547
[matchers.call.fn(getBalance), {}],
48+
[matchers.select.selector(selectDerivationPathType), DerivationPathTypeAdr8],
4649
])
4750
.dispatch(ledgerActions.enumerateAccounts(DerivationPathTypeLegacy))
4851
.put(ledgerActions.setStep(LedgerStep.Done))
@@ -89,6 +92,7 @@ describe('Ledger Sagas', () => {
8992
[matchers.call.fn(TransportWebUSB.isSupported), true],
9093
[matchers.call.fn(TransportWebUSB.create), { close: () => {} }],
9194
[matchers.call.fn(Ledger.enumerateAccounts), Promise.reject(new Error('Dummy error'))],
95+
[matchers.select.selector(selectDerivationPathType), DerivationPathTypeAdr8],
9296
])
9397
.dispatch(ledgerActions.enumerateAccounts(DerivationPathTypeAdr8))
9498
.put.like({ action: { payload: { code: WalletErrors.UnknownError, message: 'Dummy error' } } })

src/app/state/wallet/saga.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { transactionActions } from '../transaction'
1010
import { getBalance, rootWalletSaga, walletSaga, selectWallet } from './saga'
1111
import { selectActiveWallet } from './selectors'
1212
import { Wallet, WalletState } from './types'
13+
import { DerivationPathTypeAdr8, Ledger } from '../../lib/ledger'
1314

1415
describe('Wallet Sagas', () => {
1516
const validMnemonic =
@@ -61,7 +62,7 @@ describe('Wallet Sagas', () => {
6162
{
6263
address: addressHex,
6364
balance: { available: '0', debonding: '0', escrow: '0', total: '0' },
64-
path: [44, 474, 0, 0, 0],
65+
path: Ledger.mustGetPath(DerivationPathTypeAdr8, 0),
6566
publicKey: '00',
6667
selected: true,
6768
},

0 commit comments

Comments
 (0)