Skip to content

Commit

Permalink
tests: Fix saga tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matevz committed Mar 29, 2022
1 parent f2f6bca commit dd0747c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/app/lib/ledger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('Ledger Library', () => {
it('Should fail without USB transport', () => {
const signer = new LedgerSigner({
type: WalletType.Ledger,
path: [44, 474, 0, 0, 0],
path: Ledger.mustGetPath(DerivationPathTypeAdr8, 0),
publicKey: '00',
} as Wallet)

Expand Down Expand Up @@ -141,7 +141,7 @@ describe('Ledger Library', () => {

const signer = new LedgerSigner({
type: WalletType.Ledger,
path: [44, 474, 0, 0, 0],
path: Ledger.mustGetPath(DerivationPathTypeAdr8, 0),
publicKey: '00',
} as Wallet)

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

const signer = new LedgerSigner({
type: WalletType.Ledger,
path: [44, 474, 0, 0, 0],
path: Ledger.mustGetPath(DerivationPathTypeAdr8, 0),
publicKey: '00',
} as Wallet)

Expand Down
4 changes: 4 additions & 0 deletions src/app/state/ledger/saga.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { addressToPublicKey } from 'app/lib/helpers'
import { LedgerStep } from './types'
import { WalletErrors } from 'types/errors'
import { OasisTransaction } from 'app/lib/transaction'
import { selectDerivationPathType } from './selectors'

describe('Ledger Sagas', () => {
describe('enumerateAccounts', () => {
Expand All @@ -24,6 +25,7 @@ describe('Ledger Sagas', () => {
[matchers.call.fn(TransportWebUSB.create), { close: () => {} }],
[matchers.call.fn(Ledger.enumerateAccounts), [validAccount]],
[matchers.call.fn(getBalance), {}],
[matchers.select.selector(selectDerivationPathType), DerivationPathTypeAdr8],
])
.dispatch(ledgerActions.enumerateAccounts(DerivationPathTypeAdr8))
.put(ledgerActions.setStep(LedgerStep.Done))
Expand All @@ -43,6 +45,7 @@ describe('Ledger Sagas', () => {
[matchers.call.fn(TransportWebUSB.create), { close: () => {} }],
[matchers.call.fn(Ledger.enumerateAccounts), [validAccount]],
[matchers.call.fn(getBalance), {}],
[matchers.select.selector(selectDerivationPathType), DerivationPathTypeAdr8],
])
.dispatch(ledgerActions.enumerateAccounts(DerivationPathTypeLegacy))
.put(ledgerActions.setStep(LedgerStep.Done))
Expand Down Expand Up @@ -89,6 +92,7 @@ describe('Ledger Sagas', () => {
[matchers.call.fn(TransportWebUSB.isSupported), true],
[matchers.call.fn(TransportWebUSB.create), { close: () => {} }],
[matchers.call.fn(Ledger.enumerateAccounts), Promise.reject(new Error('Dummy error'))],
[matchers.select.selector(selectDerivationPathType), DerivationPathTypeAdr8],
])
.dispatch(ledgerActions.enumerateAccounts(DerivationPathTypeAdr8))
.put.like({ action: { payload: { code: WalletErrors.UnknownError, message: 'Dummy error' } } })
Expand Down
3 changes: 2 additions & 1 deletion src/app/state/wallet/saga.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { transactionActions } from '../transaction'
import { getBalance, rootWalletSaga, walletSaga, selectWallet } from './saga'
import { selectActiveWallet } from './selectors'
import { Wallet, WalletState } from './types'
import { DerivationPathTypeAdr8, Ledger } from '../../lib/ledger'

describe('Wallet Sagas', () => {
const validMnemonic =
Expand Down Expand Up @@ -61,7 +62,7 @@ describe('Wallet Sagas', () => {
{
address: addressHex,
balance: { available: '0', debonding: '0', escrow: '0', total: '0' },
path: [44, 474, 0, 0, 0],
path: Ledger.mustGetPath(DerivationPathTypeAdr8, 0),
publicKey: '00',
selected: true,
},
Expand Down

0 comments on commit dd0747c

Please sign in to comment.