import * as path from 'path' ; import * as chai from 'chai' ; import * as sinon from 'sinon' ; import * as sinonChai from 'sinon-chai' ; import { FabricWalletGenerator } from '../src/FabricWalletGenerator' ; import { FabricWalletRegistryEntry , IFabricWallet } from 'ibm-blockchain-platform-common' ; chai . use ( sinonChai ) ; describe ( 'FabricWalletGenerator' , ( ) => { const rootPath = path . dirname ( __dirname ) ; let mySandBox ; describe ( 'getWallet' , ( ) => { let fabricWalletRegistryEntry ; beforeEach ( async ( ) => { mySandBox = sinon . createSandbox ( ) ; fabricWalletRegistryEntry = new FabricWalletRegistryEntry ( ) ; fabricWalletRegistryEntry . managedWallet = false ; fabricWalletRegistryEntry . name = 'CongaWallet' ; fabricWalletRegistryEntry . walletPath = path . join ( rootPath , 'data' , 'wallet' ) ; } ) ; afterEach ( async ( ) => { mySandBox . restore ( ) ; } ) ; it ( 'should get an instance of a wallet' , async ( ) => { const wallet = await FabricWalletGenerator . instance ( ) . getWallet ( fabricWalletRegistryEntry ) ; wallet . getWalletPath ( ) . should . equal ( path . join ( rootPath , 'data' , 'wallet' ) ) ; } ) ; } ) ; } ) ;