Skip to content

Commit

Permalink
docs: comments in useMPCWallet test
Browse files Browse the repository at this point in the history
  • Loading branch information
schmanu committed Oct 4, 2023
1 parent fad177c commit 14e4872
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/hooks/wallets/mpc/__tests__/useMPCWallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import { ONBOARD_MPC_MODULE_LABEL } from '@/services/mpc/module'
import { ethers } from 'ethers'
import BN from 'bn.js'

/** time until mock login resolves */
const MOCK_LOGIN_TIME = 1000

/**
* Helper class for mocking MPC Core Kit login flow
*/
class MockMPCCoreKit {
status: COREKIT_STATUS = COREKIT_STATUS.INITIALIZED
state: {
Expand All @@ -27,6 +32,12 @@ class MockMPCCoreKit {
private stateAfterLogin: COREKIT_STATUS
private userInfoAfterLogin: UserInfo | undefined
private expectedFactorKey: BN
/**
*
* @param stateAfterLogin State after loginWithOauth resolves
* @param userInfoAfterLogin User info to set in the state after loginWithOauth resolves
* @param expectedFactorKey For MFA login flow the expected factor key. If inputFactorKey gets called with the expected factor key the state switches to logged in
*/
constructor(stateAfterLogin: COREKIT_STATUS, userInfoAfterLogin: UserInfo, expectedFactorKey: BN = new BN(-1)) {
this.stateAfterLogin = stateAfterLogin
this.userInfoAfterLogin = userInfoAfterLogin
Expand Down

0 comments on commit 14e4872

Please sign in to comment.