sdk-monorepo/src/test/web.test.ts

32 lines
952 B
TypeScript
Raw Normal View History

import chai from 'chai'
import { TorProvider } from 'lib/web'
// Waffle matchers
import { solidity } from 'ethereum-waffle'
import { ErrorUtils } from 'lib/utils'
chai.use(solidity)
const expect = chai.expect
describe.skip('web', () => {
if (!process.env.ETH_MAINNET_TEST_RPC || !process.env.TOR_PORT)
throw ErrorUtils.getError('need a tor port and mainnet rpc endpoint.')
const torProvider = new TorProvider(process.env.ETH_MAINNET_TEST_RPC, { port: +process.env.TOR_PORT })
// TODO: Make these tests better and either auto-detect proxy or spin up tor
it.skip('CONNECTED: Should be able to request over Tor', async () => {
console.log(await torProvider.getBlockNumber())
}).timeout(0)
it.skip('DISCONNECTED: Should not be able to request over Tor', async function () {
try {
await torProvider.getBlockNumber()
throw ErrorUtils.getError('should not have succeeded.')
} catch (err) {}
}).timeout(0)
})