-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import sinon from 'sinon'; | ||
|
||
import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; | ||
|
||
/** | ||
* Takes a MultiProtocolProvider instance and stubs it's get*Provider methods to | ||
* return mock providers. More provider methods can be added her as needed. | ||
* Note: callers should call `sandbox.restore()` after tests complete. | ||
*/ | ||
export function stubMultiProtocolProvider( | ||
multiProvider: MultiProtocolProvider, | ||
): sinon.SinonSandbox { | ||
const sandbox = sinon.createSandbox(); | ||
sandbox.stub(multiProvider, 'getEthersV5Provider').returns({ | ||
getBalance: async () => '100', | ||
} as any); | ||
sandbox.stub(multiProvider, 'getCosmJsProvider').returns({ | ||
getBalance: async () => ({ amount: '100' }), | ||
} as any); | ||
sandbox.stub(multiProvider, 'getCosmJsWasmProvider').returns({ | ||
getBalance: async () => ({ amount: '100' }), | ||
queryContractSmart: async () => ({ | ||
type: { native: { fungible: { denom: 'denom' } } }, | ||
}), | ||
} as any); | ||
sandbox.stub(multiProvider, 'getSolanaWeb3Provider').returns({ | ||
getBalance: async () => '100', | ||
getTokenAccountBalance: async () => ({ value: { amount: '100' } }), | ||
} as any); | ||
return sandbox; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters