@@ -7,7 +7,7 @@ const should = require('chai')
7
7
. use ( require ( 'chai-as-promised' ) )
8
8
. should ( ) ;
9
9
10
- describe ( 'expectEvent' , function ( ) {
10
+ describe . only ( 'expectEvent' , function ( ) {
11
11
beforeEach ( async function ( ) {
12
12
this . constructionValues = {
13
13
uint : 42 ,
@@ -23,15 +23,15 @@ describe('expectEvent', function () {
23
23
} ) ;
24
24
25
25
describe ( 'inConstructor' , function ( ) {
26
- context ( 'long uint value' , function ( ) {
26
+ context ( 'short uint value' , function ( ) {
27
27
it ( 'accepts emitted events with correct number' , async function ( ) {
28
- await expectEvent . inConstruction ( this . emitter , 'LongUint ' ,
28
+ await expectEvent . inConstruction ( this . emitter , 'ShortUint ' ,
29
29
{ value : this . constructionValues . uint }
30
30
) ;
31
31
} ) ;
32
32
33
33
it ( 'throws if an incorrect value is passed' , async function ( ) {
34
- return expectEvent . inConstruction ( this . emitter , 'LongUint ' ,
34
+ return expectEvent . inConstruction ( this . emitter , 'ShortUint ' ,
35
35
{ value : 23 }
36
36
) . should . be . rejected ;
37
37
} ) ;
@@ -290,9 +290,26 @@ describe('expectEvent', function () {
290
290
} ) ;
291
291
292
292
describe ( 'inTransaction' , function ( ) {
293
- it ( 'processes the logs inside a transaction' , async function ( ) {
294
- const tx = await this . emitter . emitShortUint ( 5 ) ;
295
- expectEvent . inTransaction ( tx , 'ShortInt' , { value : 5 } ) ;
293
+ describe ( 'when emitting from called contract' , function ( ) {
294
+ context ( 'short uint value' , function ( ) {
295
+ beforeEach ( async function ( ) {
296
+ this . value = 42 ;
297
+ const receipt = await this . emitter . emitShortUint ( this . value ) ;
298
+ this . txHash = receipt . tx ;
299
+ } ) ;
300
+
301
+ it ( 'accepts emitted events with correct number' , async function ( ) {
302
+ await expectEvent . inTransaction ( this . txHash , EventEmitter , 'ShortUint' , { value : this . value } ) ;
303
+ } ) ;
304
+
305
+ it ( 'throws if an unemitted event is requested' , function ( ) {
306
+ return expectEvent . inTransaction ( this . txHash , EventEmitter , 'UnemittedEvent' , { value : this . value } ) . should . be . rejected ;
307
+ } ) ;
308
+
309
+ it ( 'throws if an incorrect value is passed' , function ( ) {
310
+ return expectEvent . inTransaction ( this . txHash , EventEmitter , 'ShortUint' , { value : 23 } ) . should . be . rejected ;
311
+ } ) ;
312
+ } ) ;
296
313
} ) ;
297
314
} ) ;
298
315
} ) ;
0 commit comments