Add a test for a ProxyWrapper
This commit is contained in:
		
							
								
								
									
										35
									
								
								test/proxy_wrapper_test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								test/proxy_wrapper_test.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
 | 
					import 'mocha';
 | 
				
			||||||
 | 
					import * as chai from 'chai';
 | 
				
			||||||
 | 
					import {chaiSetup} from './utils/chai_setup';
 | 
				
			||||||
 | 
					import {web3Factory} from './utils/web3_factory';
 | 
				
			||||||
 | 
					import {ZeroEx} from '../src';
 | 
				
			||||||
 | 
					import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
 | 
				
			||||||
 | 
					import {SchemaValidator} from '../src/utils/schema_validator';
 | 
				
			||||||
 | 
					import {tokenSchema} from '../src/schemas/token_schema';
 | 
				
			||||||
 | 
					import {ProxyWrapper} from '../src/contract_wrappers/proxy_wrapper';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					chaiSetup.configure();
 | 
				
			||||||
 | 
					const expect = chai.expect;
 | 
				
			||||||
 | 
					const blockchainLifecycle = new BlockchainLifecycle();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('ProxyWrapper', () => {
 | 
				
			||||||
 | 
					    let zeroEx: ZeroEx;
 | 
				
			||||||
 | 
					    before(async () => {
 | 
				
			||||||
 | 
					        const web3 = web3Factory.create();
 | 
				
			||||||
 | 
					        zeroEx = new ZeroEx(web3.currentProvider);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    beforeEach(async () => {
 | 
				
			||||||
 | 
					        await blockchainLifecycle.startAsync();
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    afterEach(async () => {
 | 
				
			||||||
 | 
					        await blockchainLifecycle.revertAsync();
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    describe('#isAuthorizedAsync', () => {
 | 
				
			||||||
 | 
					        it('should return false if the address is not authorized', async () => {
 | 
				
			||||||
 | 
					            const proxyWrapper = (zeroEx as any)._proxyWrapper as ProxyWrapper;
 | 
				
			||||||
 | 
					            const isAuthorized = await proxyWrapper.isAuthorizedAsync(ZeroEx.NULL_ADDRESS);
 | 
				
			||||||
 | 
					            expect(isAuthorized).to.be.false();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
		Reference in New Issue
	
	Block a user