Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Oct 31, 2024
1 parent bf1b5a8 commit eb7df95
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/unit/network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
getL2Network,
l1Networks,
l2Networks,
isL2NetworkNativeTokenEther,
L2Network,
} from '../../src/lib/dataEntities/networks'
import { constants } from 'ethers'

const ethereumMainnetChainId = 1
const arbitrumOneChainId = 42161
Expand Down Expand Up @@ -315,4 +318,28 @@ describe('Networks', async () => {
expect(l2NetworksKeys).to.have.members(expected)
})
})

describe('isL2NetworkNativeTokenEther', () => {
it('returns `true` when `nativeToken` is undefined', () => {
expect(
isL2NetworkNativeTokenEther({ nativeToken: undefined } as L2Network)
).to.equal(true)
})

it('returns `true` when `nativeToken` is zero address', () => {
expect(
isL2NetworkNativeTokenEther({
nativeToken: constants.AddressZero,
} as L2Network)
).to.equal(true)
})

it('returns `false` when `nativeToken` is a valid address', () => {
expect(
isL2NetworkNativeTokenEther({
nativeToken: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
} as L2Network)
).to.equal(false)
})
})
})

0 comments on commit eb7df95

Please sign in to comment.