require ( 'module-alias/register' ) ; import * as _ from 'lodash' ; import * as chai from 'chai' ; import { BigNumber } from 'bignumber.js' ; import ChaiSetup from '@utils/chaiSetup' ; import { BigNumberSetup } from '@utils/bigNumberSetup' ; import { UintArrayUtilsLibraryMockContract , } from '@utils/contracts' ; import { DEFAULT_GAS } from '@utils/constants' ; import { LibraryMockHelper } from '@utils/helpers/libraryMockHelper' ; BigNumberSetup . configure ( ) ; ChaiSetup . configure ( ) ; const { expect } = chai ; contract ( 'UintArrayUtilsLibrary' , accounts => { const [ deployerAccount , ] = accounts ; const libraryMockHelper = new LibraryMockHelper ( deployerAccount ) ; let arrayLibraryMock ; beforeEach ( async ( ) => { arrayLibraryMock = await libraryMockHelper . deployUintArrayUtilsLibraryAsync ( ) ; } ) ; describe ( '#sumArrayValues' , async ( ) => { let subjectArray ; beforeEach ( async ( ) => { subjectArray = [ new BigNumber ( 156 ) , new BigNumber ( 245 ) , new BigNumber ( 574 ) ] ; } ) ; async function subject ( ) { return arrayLibraryMock . sumArrayValues . callAsync ( subjectArray , { gas : DEFAULT_GAS } ) ; } it ( 'calculates the correct value' , async ( ) => { const actualOutput = await subject ( ) ; expect ( actualOutput ) . to . be . bignumber . equal ( new BigNumber ( 975 ) ) ; } ) ; } ) ; } ) ;