Commit 401eedc8 authored by Wyatt Barnes's avatar Wyatt Barnes

Add zod devDep. Add validation for provider URL in tests

parent adfcb134
......@@ -33,7 +33,8 @@
"typescript": "^5.1.6",
"viem": "^1.3.1",
"vite": "^4.4.6",
"vitest": "^0.33.0"
"vitest": "^0.33.0",
"zod": "^3.21.4"
},
"dependencies": {
"@ethereumjs/rlp": "^4.0.1",
......
import { beforeAll, describe, expect, test } from 'vitest'
import { z } from 'zod'
import Web3, { Contract, FMT_BYTES, FMT_NUMBER } from 'web3'
import {
l2StandardBridgeABI,
......@@ -9,7 +10,9 @@ import {
import OptimismFeeEstimationPlugin from './plugin'
const provider = process.env.VITE_L2_RPC_URL ?? 'https://mainnet.optimism.io'
const defaultProvider = 'https://mainnet.optimism.io'
const provider = z.string().url().default(defaultProvider).parse(process.env['VITE_L2_RPC_URL'])
if (provider === defaultProvider) console.warn('Warning: Using default public provider, this could cause tests to fail due to rate limits. Set the VITE_L2_RPC_URL env to override default provider')
describe('OptimismFeeEstimationPlugin', () => {
let web3: Web3
......
......@@ -568,6 +568,9 @@ importers:
vitest:
specifier: ^0.33.0
version: 0.33.0(jsdom@22.1.0)
zod:
specifier: ^3.21.4
version: 3.21.4
packages:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment