import * as vscode from 'vscode' ; import { BlockchainTreeItem } from '../../../extension/explorer/model/BlockchainTreeItem' ; import * as chai from 'chai' ; import * as sinon from 'sinon' ; import { BlockchainGatewayExplorerProvider } from '../../../extension/explorer/gatewayExplorer' ; import { TestUtil } from '../../TestUtil' ; import { ExtensionUtil } from '../../../extension/util/ExtensionUtil' ; chai . should ( ) ; describe ( 'BlockchainTreeItem' , ( ) => { const mySandBox = sinon . createSandbox ( ) ; class TestBlockchainTreeItem extends BlockchainTreeItem { constructor ( label ) { super ( ExtensionUtil . getBlockchainGatewayExplorerProvider ( ) , label , vscode . TreeItemCollapsibleState . None ) ; } } let treeItem ; before ( async ( ) => { await TestUtil . setupTests ( mySandBox ) ; } ) ; afterEach ( ( ) => { mySandBox . restore ( ) ; } ) ; describe ( '#tooltip' , ( ) => { it ( 'should have the tooltip' , ( ) => { treeItem = new TestBlockchainTreeItem ( 'test label' ) ; treeItem . tooltip . should . equal ( 'test label' ) ; } ) ; } ) ; describe ( '#refresh' , ( ) => { it ( 'should refresh the tree data provider' , ( ) => { treeItem = new TestBlockchainTreeItem ( 'test label' ) ; const treeDataProvider = ExtensionUtil . getBlockchainGatewayExplorerProvider ( ) ; const refreshStub = mySandBox . stub ( treeDataProvider , 'refresh' ) ; treeItem . refresh ( ) ; refreshStub . should . have . been . calledOnceWithExactly ( treeItem ) ; } ) ; } ) ; } ) ;