@@ -2,7 +2,7 @@ import { AccountKeyDerivationPath, Bip32Account, GroupedAddress, KeyRole } from
2
2
import { Cardano } from '@cardano-sdk/core' ;
3
3
import { ObservableWallet } from '../../src' ;
4
4
import { PubStakeKeyAndStatus , createPublicStakeKeysTracker } from '../../src/services/PublicStakeKeysTracker' ;
5
- import { delay , firstValueFrom , from , lastValueFrom , of , shareReplay , toArray } from 'rxjs' ;
5
+ import { firstValueFrom , from , lastValueFrom , of , shareReplay , toArray } from 'rxjs' ;
6
6
import { mockProviders as mocks } from '@cardano-sdk/util-dev' ;
7
7
8
8
describe ( 'PublicStakeKeysTracker' , ( ) => {
@@ -64,7 +64,9 @@ describe('PublicStakeKeysTracker', () => {
64
64
}
65
65
] ;
66
66
67
- derivePublicKey = jest . fn ( ) . mockImplementation ( ( path : AccountKeyDerivationPath ) => `abc-${ path . index } ` ) ;
67
+ derivePublicKey = jest
68
+ . fn ( )
69
+ . mockImplementation ( ( path : AccountKeyDerivationPath ) => Promise . resolve ( `abc-${ path . index } ` ) ) ;
68
70
bip32Account = {
69
71
accountIndex : 0 ,
70
72
chainId : Cardano . ChainIds . Preview ,
@@ -135,7 +137,7 @@ describe('PublicStakeKeysTracker', () => {
135
137
136
138
it ( 'emits when reward accounts change' , async ( ) => {
137
139
const addresses$ = of ( addresses ) ;
138
- const rewardAccounts$ = from ( [ [ rewardAccounts [ 0 ] ] , rewardAccounts ] ) . pipe ( delay ( 1 ) ) ;
140
+ const rewardAccounts$ = from ( [ [ rewardAccounts [ 0 ] ] , rewardAccounts ] ) ;
139
141
140
142
const stakePubKeys$ = createPublicStakeKeysTracker ( {
141
143
addresses$,
@@ -155,7 +157,7 @@ describe('PublicStakeKeysTracker', () => {
155
157
} ) ;
156
158
157
159
it ( 'emits when addresses change' , async ( ) => {
158
- const addresses$ = from ( [ [ addresses [ 0 ] ] , addresses ] ) . pipe ( delay ( 1 ) ) ;
160
+ const addresses$ = from ( [ [ addresses [ 0 ] ] , addresses ] ) ;
159
161
const rewardAccounts$ = of ( rewardAccounts ) ;
160
162
161
163
const stakePubKeys$ = createPublicStakeKeysTracker ( {
@@ -176,9 +178,8 @@ describe('PublicStakeKeysTracker', () => {
176
178
} ) ;
177
179
178
180
it ( 'does not emit duplicates' , async ( ) => {
179
- const rewardAccounts$ = from ( [ rewardAccounts , rewardAccounts ] ) . pipe ( delay ( 1 ) ) ;
181
+ const rewardAccounts$ = from ( [ rewardAccounts , rewardAccounts ] ) ;
180
182
const addresses$ = from ( [ [ addresses [ 0 ] ] , addresses , addresses ] ) . pipe (
181
- delay ( 1 ) ,
182
183
shareReplay ( { bufferSize : 1 , refCount : true } )
183
184
) ;
184
185
0 commit comments