File tree Expand file tree Collapse file tree 1 file changed +18
-25
lines changed
Expand file tree Collapse file tree 1 file changed +18
-25
lines changed Original file line number Diff line number Diff line change @@ -112,38 +112,31 @@ describe('mitt#', () => {
112112 } ) ;
113113
114114 it ( 'should NOT ignore case' , ( ) => {
115- let foo = spy ( ) ,
116- bar = spy ( ) ,
117- num = 123 ;
118- events . Foo = [ foo ] ;
119- events . FOO = [ bar ] ;
120-
121- inst . emit ( 'FOO' , num ) ;
122- inst . emit ( 'Foo' , num ) ;
123-
124- let args1 = foo . args [ 0 ] ;
125- let args2 = bar . args [ 0 ] ;
126-
127- expect ( foo ) . to . have . been . calledOnce ;
128- expect ( bar ) . to . have . been . calledOnce ;
129- expect ( args1 ) . to . be . deep . equal ( [ num ] ) ;
130- expect ( args2 ) . to . be . deep . equal ( [ num ] ) ;
115+ let onFoo = spy ( ) ,
116+ onFOO = spy ( ) ;
117+ events . Foo = [ onFoo ] ;
118+ events . FOO = [ onFOO ] ;
119+
120+ inst . emit ( 'Foo' , 'Foo arg' ) ;
121+ inst . emit ( 'FOO' , 'FOO arg' ) ;
122+
123+ expect ( onFoo ) . to . have . been . calledOnce . and . calledWith ( 'Foo arg' ) ;
124+ expect ( onFOO ) . to . have . been . calledOnce . and . calledWith ( 'FOO arg' ) ;
131125 } ) ;
132126
133127 it ( 'should invoke * handlers' , ( ) => {
134128 let star = spy ( ) ,
135- aa = 'bb' ;
136- events [ '*' ] = [ star ] ;
129+ ea = { a : 'a' } ,
130+ eb = { b : 'b' } ;
137131
138- inst . emit ( 'foo' , aa ) ;
139- inst . emit ( 'bar' , aa ) ;
132+ events [ '*' ] = [ star ] ;
140133
141- let args1 = star . args [ 0 ] ,
142- args2 = star . args [ 1 ] ;
134+ inst . emit ( 'foo' , ea ) ;
135+ expect ( star ) . to . have . been . calledOnce . and . calledWith ( 'foo' , ea ) ;
136+ star . reset ( ) ;
143137
144- expect ( star ) . to . have . been . calledTwice ;
145- expect ( args1 ) . to . deep . equal ( [ 'foo' , aa ] ) ;
146- expect ( args2 ) . to . deep . equal ( [ 'bar' , aa ] ) ;
138+ inst . emit ( 'bar' , eb ) ;
139+ expect ( star ) . to . have . been . calledOnce . and . calledWith ( 'bar' , eb ) ;
147140 } ) ;
148141 } ) ;
149142} ) ;
You can’t perform that action at this time.
0 commit comments