aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/test/subscription_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers/test/subscription_test.ts')
-rw-r--r--packages/contract-wrappers/test/subscription_test.ts35
1 files changed, 19 insertions, 16 deletions
diff --git a/packages/contract-wrappers/test/subscription_test.ts b/packages/contract-wrappers/test/subscription_test.ts
index 80d17576f..0fa6af40d 100644
--- a/packages/contract-wrappers/test/subscription_test.ts
+++ b/packages/contract-wrappers/test/subscription_test.ts
@@ -1,14 +1,20 @@
-import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
-import { DoneCallback } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { DoneCallback } from '@0x/types';
import * as _ from 'lodash';
import 'mocha';
import * as Sinon from 'sinon';
-import { ContractWrappers, DecodedLogEvent, ERC20TokenApprovalEventArgs, ERC20TokenEvents, Token } from '../src';
+import {
+ ContractWrappers,
+ ContractWrappersConfig,
+ DecodedLogEvent,
+ ERC20TokenApprovalEventArgs,
+ ERC20TokenEvents,
+} from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -17,17 +23,15 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('SubscriptionTest', () => {
let contractWrappers: ContractWrappers;
- let userAddresses: string[];
- let coinbase: string;
- let addressWithoutFunds: string;
- const config = {
- networkId: constants.TESTRPC_NETWORK_ID,
- };
+ let config: ContractWrappersConfig;
+
before(async () => {
+ const contractAddresses = await migrateOnceAsync();
+ config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ };
contractWrappers = new ContractWrappers(provider, config);
- userAddresses = await web3Wrapper.getAvailableAddressesAsync();
- coinbase = userAddresses[0];
- addressWithoutFunds = userAddresses[1];
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -38,7 +42,6 @@ describe('SubscriptionTest', () => {
describe('#subscribe', () => {
const indexFilterValues = {};
let tokenAddress: string;
- const allowanceAmount = new BigNumber(42);
let stubs: Sinon.SinonStub[] = [];
before(() => {
const tokenAddresses = tokenUtils.getDummyERC20TokenAddresses();
@@ -52,7 +55,7 @@ describe('SubscriptionTest', () => {
it('Should allow unsubscribeAll to be called successfully after an error', (done: DoneCallback) => {
(async () => {
const callback = (err: Error | null, _logEvent?: DecodedLogEvent<ERC20TokenApprovalEventArgs>) =>
- _.noop;
+ _.noop.bind(_);
contractWrappers.erc20Token.subscribe(
tokenAddress,
ERC20TokenEvents.Approval,
@@ -60,7 +63,7 @@ describe('SubscriptionTest', () => {
callback,
);
stubs = [
- Sinon.stub((contractWrappers as any)._web3Wrapper, 'getBlockAsync').throws(
+ Sinon.stub((contractWrappers as any)._web3Wrapper, 'getBlockIfExistsAsync').throws(
new Error('JSON RPC error'),
),
];