@@ -226,22 +226,22 @@ describe('Contract', function () {
226226 isCompiled . should . be . equal ( true )
227227 } )
228228 it ( 'Dry-run deploy fn' , async ( ) => {
229- const res = await contractObject . methods . init . get ( '123' , 1 , Promise . resolve ( 'hahahaha' ) )
229+ const res = await contractObject . methods . init . get ( '123' , 1 , 'hahahaha' )
230230 res . result . should . have . property ( 'gasUsed' )
231231 res . result . should . have . property ( 'returnType' )
232232 } )
233233 it ( 'Dry-run deploy fn on specific account' , async ( ) => {
234234 const current = await contract . address ( )
235235 const onAccount = contract . addresses ( ) . find ( acc => acc !== current )
236- const { result } = await contractObject . methods . init . get ( '123' , 1 , Promise . resolve ( 'hahahaha' ) , { onAccount } )
236+ const { result } = await contractObject . methods . init . get ( '123' , 1 , 'hahahaha' , { onAccount } )
237237 result . should . have . property ( 'gasUsed' )
238238 result . should . have . property ( 'returnType' )
239239 result . callerId . should . be . equal ( onAccount )
240240 } )
241241
242242 it ( 'Deploy contract before compile' , async ( ) => {
243243 contractObject . compiled = null
244- await contractObject . methods . init ( '123' , 1 , Promise . resolve ( 'hahahaha' ) )
244+ await contractObject . methods . init ( '123' , 1 , 'hahahaha' )
245245 const isCompiled = contractObject . compiled . length && contractObject . compiled . slice ( 0 , 3 ) === 'cb_'
246246 isCompiled . should . be . equal ( true )
247247 } )
@@ -383,22 +383,22 @@ describe('Contract', function () {
383383 } )
384384 it ( 'Map With Option Value' , async ( ) => {
385385 const address = await contract . address ( )
386- let mapArgWithSomeValue = new Map (
386+ const mapArgWithSomeValue = new Map (
387387 [
388- [ address , [ 'someStringV' , Promise . resolve ( 123 ) ] ]
388+ [ address , [ 'someStringV' , 123 ] ]
389389 ]
390390 )
391- let mapArgWithNoneValue = new Map (
391+ const mapArgWithNoneValue = new Map (
392392 [
393- [ address , [ 'someStringV' , Promise . reject ( Error ( ) ) . catch ( e => undefined ) ] ]
393+ [ address , [ 'someStringV' , undefined ] ]
394394 ]
395395 )
396- let returnArgWithSomeValue = new Map (
396+ const returnArgWithSomeValue = new Map (
397397 [
398398 [ address , [ 'someStringV' , 123 ] ]
399399 ]
400400 )
401- let returnArgWithNoneValue = new Map (
401+ const returnArgWithNoneValue = new Map (
402402 [
403403 [ address , [ 'someStringV' , undefined ] ]
404404 ]
@@ -435,7 +435,7 @@ describe('Contract', function () {
435435 describe ( 'RECORD/STATE' , function ( ) {
436436 const objEq = ( obj , obj2 ) => ! Object . entries ( obj ) . find ( ( [ key , val ] ) => JSON . stringify ( obj2 [ key ] ) !== JSON . stringify ( val ) )
437437 it ( 'Valid Set Record (Cast from JS object)' , async ( ) => {
438- await contractObject . methods . setRecord ( { value : 'qwe' , key : 1234 , testOption : Promise . resolve ( 'test' ) } )
438+ await contractObject . methods . setRecord ( { value : 'qwe' , key : 1234 , testOption : 'test' } )
439439 const state = await contractObject . methods . getRecord ( )
440440
441441 objEq ( state . decodedResult , { value : 'qwe' , key : 1234 , testOption : 'test' } ) . should . be . equal ( true )
@@ -445,7 +445,7 @@ describe('Contract', function () {
445445 objEq ( result . decodedResult , { value : 'qwe' , key : 1234 , testOption : 'test' } ) . should . be . equal ( true )
446446 } )
447447 it ( 'Get Record With Option (Convert to JS object)' , async ( ) => {
448- await contractObject . methods . setRecord ( { key : 1234 , value : 'qwe' , testOption : Promise . resolve ( 'resolved string' ) } )
448+ await contractObject . methods . setRecord ( { key : 1234 , value : 'qwe' , testOption : 'resolved string' } )
449449 const result = await contractObject . methods . getRecord ( )
450450 objEq ( result . decodedResult , { value : 'qwe' , key : 1234 , testOption : 'resolved string' } ) . should . be . equal ( true )
451451 } )
@@ -459,25 +459,25 @@ describe('Contract', function () {
459459 } )
460460 describe ( 'OPTION' , function ( ) {
461461 it ( 'Set Some Option Value(Cast from JS value/Convert result to JS)' , async ( ) => {
462- const optionRes = await contractObject . methods . intOption ( Promise . resolve ( 123 ) )
462+ const optionRes = await contractObject . methods . intOption ( 123 )
463463
464464 optionRes . decodedResult . should . be . equal ( 123 )
465465 } )
466466 it ( 'Set Some Option List Value(Cast from JS value/Convert result to JS)' , async ( ) => {
467- const optionRes = await contractObject . methods . listOption ( Promise . resolve ( [ [ 1 , 'testString' ] ] ) )
467+ const optionRes = await contractObject . methods . listOption ( [ [ 1 , 'testString' ] ] )
468468
469469 JSON . stringify ( optionRes . decodedResult ) . should . be . equal ( JSON . stringify ( [ [ 1 , 'testString' ] ] ) )
470470 } )
471471 it ( 'Set None Option Value(Cast from JS value/Convert to JS)' , async ( ) => {
472- const optionRes = await contractObject . methods . intOption ( Promise . reject ( Error ( ) ) )
472+ const optionRes = await contractObject . methods . intOption ( undefined )
473473 const isUndefined = optionRes . decodedResult === undefined
474474 isUndefined . should . be . equal ( true )
475475 } )
476476 it ( 'Invalid option type' , async ( ) => {
477477 try {
478- await contractObject . methods . intOption ( { s : 2 } )
478+ await contractObject . methods . intOption ( 'string' )
479479 } catch ( e ) {
480- e . message . should . be . equal ( '"Argument" at position 0 fails because [Value \'[[object Object]]\' at path: [0] not a Promise ]' )
480+ e . message . should . be . equal ( '"Argument" at position 0 fails because [Value "[string]" at path: [0] not a number ]' )
481481 }
482482 } )
483483 } )
0 commit comments