File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,9 @@ function assertValidateOptions(options) {
2626 const ajv = new Ajv ( { allErrors : true } ) ;
2727 const valid = ajv . validate ( optionsSchema , options ) ;
2828 if ( ! valid ) {
29- throw new Ajv . ValidationError ( ajv . errors ) ;
29+ const err = new Error ( 'Invalid options for ObjectMapper' ) ;
30+ err . errors = ajv . errors ;
31+ throw err ;
3032 }
3133}
3234
Original file line number Diff line number Diff line change @@ -13,15 +13,24 @@ const TruffleConfig = require('@truffle/config');
1313const deployedAddress = '0x254dffcd3277C0b1660F6d42EFbB754edaBAbC2B' ;
1414
1515describe ( 'Mapper' , function ( ) {
16- let mapper ;
17-
18- before ( function ( ) {
19- mapper = new Mapper ( {
20- workingDirectory : __dirname ,
16+ describe ( 'constructor' , function ( ) {
17+ it ( 'rejects invalid options' , function ( ) {
18+ chai . expect ( ( ) => {
19+ new Mapper ( {
20+ workingDirectory : { } ,
21+ } ) ;
22+ } ) . to . throw ( ) ;
2123 } ) ;
2224 } ) ;
2325
2426 describe ( 'map' , function ( ) {
27+ let mapper ;
28+ before ( function ( ) {
29+ mapper = new Mapper ( {
30+ workingDirectory : __dirname ,
31+ } ) ;
32+ } ) ;
33+
2534 it ( 'uses defaults' , async function ( ) {
2635 const values = await mapper . map ( 'MetaCoin' , deployedAddress ) ;
2736 chai . expect ( values ) . to . have . property ( 'bytes32Example' , 'bytes 32 example' ) ;
You can’t perform that action at this time.
0 commit comments