import * as chai from 'chai' ; import * as sinon from 'sinon' ; import * as vscode from 'vscode' ; import { ExtensionUtil } from '../../../extension/util/ExtensionUtil' ; import { InstantiatedTreeItem } from '../../../extension/explorer/model/InstantiatedTreeItem' ; import { ChannelTreeItem } from '../../../extension/explorer/model/ChannelTreeItem' ; import { UserInputUtil } from '../../../extension/commands/UserInputUtil' ; const should = chai . should ( ) ; describe ( 'InstantiatedTreeItem' , ( ) => { class TestInstantiatedTreeItem extends InstantiatedTreeItem { constructor ( public readonly name , public readonly channels , public readonly version , public readonly collapsibleState , public readonly contracts ? , public readonly showIcon ? ) { super ( ExtensionUtil . getBlockchainWalletExplorerProvider ( ) , name , channels , version , collapsibleState , contracts , showIcon ) ; } } let mySandBox ; let treeItem ; beforeEach ( ( ) => { mySandBox = sinon . createSandbox ( ) ; } ) ; afterEach ( ( ) => { mySandBox . restore ( ) ; } ) ; describe ( 'constructor' , ( ) => { it ( 'should create tree item' , ( ) => { treeItem = new TestInstantiatedTreeItem ( 'mySmartContract' , [ new ChannelTreeItem ( ExtensionUtil . getBlockchainWalletExplorerProvider ( ) , 'myChannel' , [ ] , [ ] , UserInputUtil . V2_0 , vscode . TreeItemCollapsibleState . Collapsed ) , new ChannelTreeItem ( ExtensionUtil . getBlockchainWalletExplorerProvider ( ) , 'myOtherChannel' , [ ] , [ ] , UserInputUtil . V2_0 , vscode . TreeItemCollapsibleState . Collapsed ) ] , '0.0.1' , vscode . TreeItemCollapsibleState . None , [ ] , false ) ; treeItem . tooltip . should . equal ( `Instantiated on: myChannel, myOtherChannel` ) ; should . not . exist ( treeItem . iconPath ) ; } ) ; } ) ; } ) ;