aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/test
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-11 16:24:55 +0800
committerFabio Berger <me@fabioberger.com>2018-06-11 16:24:55 +0800
commitce6078ed9455aa21f31970f3d3acc4401200cc5d (patch)
tree50809c45b6d940f44b6ac753433b5bb20557940d /packages/contract-wrappers/test
parent817c332d11835f02726f0609374d1c25c9ab39b5 (diff)
downloaddexon-sol-tools-ce6078ed9455aa21f31970f3d3acc4401200cc5d.tar
dexon-sol-tools-ce6078ed9455aa21f31970f3d3acc4401200cc5d.tar.gz
dexon-sol-tools-ce6078ed9455aa21f31970f3d3acc4401200cc5d.tar.bz2
dexon-sol-tools-ce6078ed9455aa21f31970f3d3acc4401200cc5d.tar.lz
dexon-sol-tools-ce6078ed9455aa21f31970f3d3acc4401200cc5d.tar.xz
dexon-sol-tools-ce6078ed9455aa21f31970f3d3acc4401200cc5d.tar.zst
dexon-sol-tools-ce6078ed9455aa21f31970f3d3acc4401200cc5d.zip
Refactor ExchangeTransferSimulator public interface to accet an AbstractBalanceAndProxyAllowanceLazyStore so that this module could be re-used in different contexts.
Diffstat (limited to 'packages/contract-wrappers/test')
-rw-r--r--packages/contract-wrappers/test/exchange_transfer_simulator_test.ts7
-rw-r--r--packages/contract-wrappers/test/order_validation_test.ts7
2 files changed, 12 insertions, 2 deletions
diff --git a/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts b/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts
index 8bbe04d6c..1690eb392 100644
--- a/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts
+++ b/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts
@@ -5,6 +5,7 @@ import * as chai from 'chai';
import 'make-promises-safe';
import { ContractWrappers, ExchangeContractErrs } from '../src';
+import { BalanceAndProxyAllowanceLazyStore } from '../src/stores/balance_proxy_allowance_lazy_store';
import { TradeSide, TransferType } from '../src/types';
import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simulator';
@@ -44,7 +45,11 @@ describe('ExchangeTransferSimulator', () => {
});
describe('#transferFromAsync', () => {
beforeEach(() => {
- exchangeTransferSimulator = new ExchangeTransferSimulator(contractWrappers.token, BlockParamLiteral.Latest);
+ const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
+ contractWrappers.token,
+ BlockParamLiteral.Latest,
+ );
+ exchangeTransferSimulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
});
it("throws if the user doesn't have enough allowance", async () => {
return expect(
diff --git a/packages/contract-wrappers/test/order_validation_test.ts b/packages/contract-wrappers/test/order_validation_test.ts
index a42a6a368..b88684dd0 100644
--- a/packages/contract-wrappers/test/order_validation_test.ts
+++ b/packages/contract-wrappers/test/order_validation_test.ts
@@ -8,6 +8,7 @@ import 'make-promises-safe';
import * as Sinon from 'sinon';
import { ContractWrappers, ExchangeContractErrs, SignedOrder, Token } from '../src';
+import { BalanceAndProxyAllowanceLazyStore } from '../src/stores/balance_proxy_allowance_lazy_store';
import { TradeSide, TransferType } from '../src/types';
import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simulator';
import { OrderValidationUtils } from '../src/utils/order_validation_utils';
@@ -332,7 +333,11 @@ describe('OrderValidation', () => {
return Sinon.match((value: BigNumber) => value.eq(expected));
};
beforeEach('create exchangeTransferSimulator', async () => {
- exchangeTransferSimulator = new ExchangeTransferSimulator(contractWrappers.token, BlockParamLiteral.Latest);
+ const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
+ contractWrappers.token,
+ BlockParamLiteral.Latest,
+ );
+ exchangeTransferSimulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
transferFromAsync = Sinon.spy();
exchangeTransferSimulator.transferFromAsync = transferFromAsync as any;
});