File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1- /* global describe, it, expect */
1+ /* global jest, describe, it, expect */
22
33import Bee from '../../src/bee' ;
44import BeeCell , { FeatureType } from '../../src/beeCell' ;
@@ -70,13 +70,18 @@ describe("Bee", function () {
7070 pegmanY : 0 ,
7171 } ) ;
7272
73+ const flowerEmptySpy = jest . fn ( ) ;
74+ bee . on ( 'flowerEmpty' , flowerEmptySpy ) ;
7375 bee . reset ( ) ;
7476 expect ( bee . getCell ( 0 , 0 ) . isFlower ( ) ) . toEqual ( true ) ;
7577
7678 // Can get nectar twice.
7779 expect ( bee . tryGetNectar ( ) ) . toEqual ( true ) ;
7880 expect ( bee . tryGetNectar ( ) ) . toEqual ( true ) ;
81+
82+ // Getting nectar again returns false, and emits a "flowerEmpty" event.
7983 expect ( bee . tryGetNectar ( ) ) . toEqual ( false ) ;
84+ expect ( flowerEmptySpy ) . toHaveBeenCalledTimes ( 1 ) ;
8085 } )
8186 } ) ;
8287} ) ;
You can’t perform that action at this time.
0 commit comments