Skip to content

Commit

Permalink
fix: Fix tests for address & provider
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista committed Feb 14, 2024
1 parent 024000d commit a2a06ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions packages/devtools-evm/test/address.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="jest-extended" />

import fc from 'fast-check'
import { AddressZero } from 'ethers'
import { ZeroAddress } from 'ethers'
import { evmAddressArbitrary } from '@layerzerolabs/test-devtools'
import { addChecksum, makeZeroAddress } from '@/address'
import { isAddress } from 'ethers'
Expand All @@ -11,23 +11,23 @@ describe('address', () => {
it('should return address with non-zero address', () => {
fc.assert(
fc.property(evmAddressArbitrary, (address) => {
fc.pre(address !== AddressZero)
fc.pre(address !== ZeroAddress)

expect(makeZeroAddress(address)).toBe(address)
})
)
})

it('should return undefined with zero address', () => {
expect(makeZeroAddress(AddressZero)).toBe(AddressZero)
expect(makeZeroAddress(ZeroAddress)).toBe(ZeroAddress)
})

it('should return undefined with undefined', () => {
expect(makeZeroAddress(undefined)).toBe(AddressZero)
expect(makeZeroAddress(undefined)).toBe(ZeroAddress)
})

it('should return undefined with null', () => {
expect(makeZeroAddress(null)).toBe(AddressZero)
expect(makeZeroAddress(null)).toBe(ZeroAddress)
})
})

Expand Down
8 changes: 6 additions & 2 deletions packages/devtools-evm/test/provider/factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ describe('provider/factory', () => {
const provider = await providerFactory(eid)

expect(provider).toBeInstanceOf(JsonRpcProvider)
expect(provider.connection.url).toBe(url)
expect(provider._getConnection().toString()).toBe(
`<FetchRequest method="GET" url="${url}" headers={"accept-encoding":"gzip"} body=null>`
)
})
)
})
Expand All @@ -57,7 +59,9 @@ describe('provider/factory', () => {
const provider = await providerFactory(eid)

expect(provider).toBeInstanceOf(JsonRpcProvider)
expect(provider.connection.url).toBe(url)
expect(provider._getConnection().toString()).toBe(
`<FetchRequest method="GET" url="${url}" headers={"accept-encoding":"gzip"} body=null>`
)
})
)
})
Expand Down

0 comments on commit a2a06ed

Please sign in to comment.