aboutsummaryrefslogtreecommitdiffstats
path: root/test/web3_wrapper_test.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-07-07 06:42:00 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-07-07 06:42:00 +0800
commit0f3f557e0b535f9ca94af9345be118e03e37ed70 (patch)
treedaa12e2b4239900a09c3fcf617da1b94e7fe1c27 /test/web3_wrapper_test.ts
parent21cb428b38f0ad518db68f45f45a922f7aa6c7fd (diff)
downloaddexon-sol-tools-0f3f557e0b535f9ca94af9345be118e03e37ed70.tar
dexon-sol-tools-0f3f557e0b535f9ca94af9345be118e03e37ed70.tar.gz
dexon-sol-tools-0f3f557e0b535f9ca94af9345be118e03e37ed70.tar.bz2
dexon-sol-tools-0f3f557e0b535f9ca94af9345be118e03e37ed70.tar.lz
dexon-sol-tools-0f3f557e0b535f9ca94af9345be118e03e37ed70.tar.xz
dexon-sol-tools-0f3f557e0b535f9ca94af9345be118e03e37ed70.tar.zst
dexon-sol-tools-0f3f557e0b535f9ca94af9345be118e03e37ed70.zip
Fix a typo in a filename
Diffstat (limited to 'test/web3_wrapper_test.ts')
-rw-r--r--test/web3_wrapper_test.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/web3_wrapper_test.ts b/test/web3_wrapper_test.ts
new file mode 100644
index 000000000..1989bd4bc
--- /dev/null
+++ b/test/web3_wrapper_test.ts
@@ -0,0 +1,29 @@
+import * as chai from 'chai';
+import {web3Factory} from './utils/web3_factory';
+import {ZeroEx} from '../src/';
+import {Web3Wrapper} from '../src/web3_wrapper';
+import {constants} from './utils/constants';
+
+chai.config.includeStack = true;
+const expect = chai.expect;
+
+describe('Web3Wrapper', () => {
+ const web3Provider = web3Factory.create().currentProvider;
+ describe('#getNetworkIdIfExistsAsync', () => {
+ it('caches network id requests', async () => {
+ const web3Wrapper = (new ZeroEx(web3Provider) as any)._web3Wrapper as Web3Wrapper;
+ expect((web3Wrapper as any).networkIdIfExists).to.be.undefined();
+ const networkId = await web3Wrapper.getNetworkIdIfExistsAsync();
+ expect((web3Wrapper as any).networkIdIfExists).to.be.equal(constants.TESTRPC_NETWORK_ID);
+ });
+ it('invalidates network id cache on setProvider call', async () => {
+ const web3Wrapper = (new ZeroEx(web3Provider) as any)._web3Wrapper as Web3Wrapper;
+ expect((web3Wrapper as any).networkIdIfExists).to.be.undefined();
+ const networkId = await web3Wrapper.getNetworkIdIfExistsAsync();
+ expect((web3Wrapper as any).networkIdIfExists).to.be.equal(constants.TESTRPC_NETWORK_ID);
+ const newProvider = web3Factory.create().currentProvider;
+ web3Wrapper.setProvider(newProvider);
+ expect((web3Wrapper as any).networkIdIfExists).to.be.undefined();
+ });
+ });
+});