File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -74,11 +74,34 @@ describe("measure", () => {
7474 expect ( count ) . toBe ( 100 ) ;
7575 } ) ;
7676
77+ it ( "provides result of beforeEach to function" , async ( ) => {
78+ await measure ( ( value ) => {
79+ if ( value !== 1 ) {
80+ throw new Error ( "error" ) ;
81+ }
82+ } , {
83+ beforeEach : ( ) => 1
84+ } ) ;
85+ } ) ;
86+
7787 it ( "supports an afterEach callback" , async ( ) => {
7888 let count = 0 ;
7989 await measure ( ( ) => { } , { afterEach : ( ) => count ++ } ) ;
8090 expect ( count ) . toBe ( 100 ) ;
8191 } ) ;
92+
93+ it ( "provides result of beforeEach and function to afterEach" , async ( ) => {
94+ await measure ( ( ) => {
95+ return 2 ;
96+ } , {
97+ beforeEach : ( ) => 1 ,
98+ afterEach : ( beforeValue , functionValue ) => {
99+ if ( beforeValue !== 1 || functionValue !== 2 ) {
100+ throw new Error ( "error" ) ;
101+ }
102+ }
103+ } ) ;
104+ } ) ;
82105} ) ;
83106
84107describe ( "Measurement" , ( ) => {
You can’t perform that action at this time.
0 commit comments