File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/businessLogic/eventHub Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ import { TreeViewItem } from "../contracts/types" ;
2+ import { eventHub , eventManager } from "./explorerEventPublisher" ;
3+
4+ const itemCheckeckedCallBack = ( items : TreeViewItem [ ] ) => { } ;
5+
6+ const callBacks = {
7+ itemCheckeckedCallBack,
8+ }
9+
10+
11+ describe ( "eventPublisher" , ( ) => {
12+ it ( "should notify subscribers of all items checked of a type" , ( ) => {
13+ const expectedCheckedItem : TreeViewItem = {
14+ id : '1' ,
15+ name : 'Test' ,
16+ type : '.doc' ,
17+ } ;
18+ const subscriberCallBack = jest . spyOn ( callBacks , "itemCheckeckedCallBack" ) ;
19+
20+ eventManager . subscribeToItemChecked ( '.doc' , callBacks . itemCheckeckedCallBack ) ;
21+ eventHub . onItemChecked ( expectedCheckedItem )
22+
23+ expect ( subscriberCallBack ) . toBeCalledWith ( [ expectedCheckedItem ] ) ;
24+ } ) ;
25+ } ) ;
You can’t perform that action at this time.
0 commit comments