1+ // @flow
2+
13import BigNumber from 'bignumber.js' ;
24import chai from 'chai' ;
35import 'mocha' ;
@@ -14,13 +16,15 @@ import {
1416 makeTemplateWithFinalized ,
1517 makeSecurityTokenThroughRegistrar ,
1618} from './util/make_examples' ;
17- import { makeWeb3Wrapper } from './util/web3' ;
19+ import { makeWeb3Wrapper , makeWeb3 } from './util/web3' ;
1820import { fakeAddress } from './util/fake' ;
1921
2022const { assert } = chai ;
2123
2224describe ( 'Compliance wrapper' , ( ) => {
2325 const web3Wrapper = makeWeb3Wrapper ( ) ;
26+ const web3 = makeWeb3 ( ) ;
27+ const expiryTime = new BigNumber ( web3 . eth . getBlock ( 'latest' ) . timestamp ) . plus ( 10000 ) ;
2428
2529 let accounts ;
2630 let polyToken ;
@@ -70,24 +74,26 @@ describe('Compliance wrapper', () => {
7074 } ) ;
7175
7276 it ( 'createTemplate' , async ( ) => {
73- await makeKYCProvider ( customers , accounts [ 1 ] ) ;
74- await makeLegalDelegate ( polyToken , customers , accounts [ 1 ] , accounts [ 2 ] ) ;
77+ await makeKYCProvider ( customers , accounts [ 1 ] , expiryTime ) ;
78+ await makeLegalDelegate ( polyToken , customers , accounts [ 1 ] , accounts [ 2 ] , expiryTime ) ;
7579 const templateAddress = await makeTemplate (
7680 compliance ,
7781 accounts [ 1 ] ,
7882 accounts [ 2 ] ,
83+ expiryTime ,
7984 ) ;
8085
8186 assert . isAbove ( templateAddress . length , 0 ) ;
8287 } ) ;
8388
8489 it ( 'proposeTemplate, templateReputation, getTemplateAddressByProposal, cancelTemplateProposal' , async ( ) => {
85- await makeKYCProvider ( customers , accounts [ 1 ] ) ;
86- await makeLegalDelegate ( polyToken , customers , accounts [ 1 ] , accounts [ 2 ] ) ;
90+ await makeKYCProvider ( customers , accounts [ 1 ] , expiryTime ) ;
91+ await makeLegalDelegate ( polyToken , customers , accounts [ 1 ] , accounts [ 2 ] , expiryTime ) ;
8792 const templateAddress = await makeTemplateWithFinalized (
8893 compliance ,
8994 accounts [ 1 ] ,
9095 accounts [ 2 ] ,
96+ expiryTime ,
9197 ) ;
9298
9399 // Propose Template
@@ -109,7 +115,7 @@ describe('Compliance wrapper', () => {
109115 } ) ;
110116
111117 it ( 'setSTO' , async ( ) => {
112- await makeKYCProvider ( customers , accounts [ 1 ] ) ;
118+ await makeKYCProvider ( customers , accounts [ 1 ] , expiryTime ) ;
113119
114120 await compliance . setSTO (
115121 accounts [ 0 ] ,
@@ -135,7 +141,7 @@ describe('Compliance wrapper', () => {
135141 let subscriptionID1 = null ;
136142 const eventName1 = 'LogTemplateCreated' ;
137143 const indexedFilterValues1 = [ "_creator" ] ;
138-
144+ const expiryTime = new BigNumber ( web3 . eth . getBlock ( 'latest' ) . timestamp ) . plus ( 10000 ) ;
139145 //the callback is passed into the filter.watch function, and is operated on when a new event comes in
140146 const logTemplateCreatedArgsPromise = new Promise ( ( resolve , reject ) => {
141147 subscriptionID1 = compliance . subscribe ( eventName1 , indexedFilterValues1 , ( err , log ) => {
@@ -181,12 +187,13 @@ describe('Compliance wrapper', () => {
181187 } ) ;
182188 } ) ;
183189
184- await makeKYCProvider ( customers , accounts [ 1 ] ) ;
185- await makeLegalDelegate ( polyToken , customers , accounts [ 1 ] , accounts [ 2 ] ) ;
190+ await makeKYCProvider ( customers , accounts [ 1 ] , expiryTime ) ;
191+ await makeLegalDelegate ( polyToken , customers , accounts [ 1 ] , accounts [ 2 ] , expiryTime ) ;
186192 const templateAddress = await makeTemplate (
187193 compliance ,
188194 accounts [ 1 ] ,
189195 accounts [ 2 ] ,
196+ expiryTime ,
190197 ) ;
191198
192199
0 commit comments