Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yivlad committed Dec 12, 2024
1 parent d77b367 commit a57ae32
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
4 changes: 1 addition & 3 deletions packages/common-testnets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
}
}
},
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"lint": "eslint src",
"verify": "concurrently --names \"LINT,TEST,TYPECHECK,LINT-CUSTOM\" -c \"bgMagenta.bold,bgGreen.bold,bgBlue.bold,bgCyan.bold\" \"pnpm run lint\" \"pnpm run test --silent\" \"pnpm run typecheck\"",
Expand Down
16 changes: 9 additions & 7 deletions packages/common-testnets/src/TestnetFactory.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getEnv } from '@marsfoundation/common-nodejs/env'
import { expect } from 'earl'
import { describe, it, before, after } from 'mocha'
import { after, before, describe, it } from 'mocha'
import { TestnetClient } from './TestnetClient'
import { TestnetFactory } from './TestnetFactory'
import { AnvilTestnetFactory } from './anvil'
Expand Down Expand Up @@ -29,7 +29,7 @@ describe('TestnetFactory', () => {
const expectedTimestamp = 1733909123n + 2n

before(async () => {
({ client: testnetClient, cleanup } = await factory.create({
;({ client: testnetClient, cleanup } = await factory.create({
id: 'test',
originChainId: 1,
forkChainId: expectedChainId,
Expand Down Expand Up @@ -73,18 +73,20 @@ describe('TestnetFactory', () => {
})

it('does not contain tx from future block', async () => {
await expect(testnetClient.getTransactionReceipt({
hash: '0x7057abf025862e54cb1c33b4f4d4e6f8793383098abb84e58a85d1f10d14b765',
})).toBeRejectedWith('The Transaction may not be processed on a block yet.')
await expect(
testnetClient.getTransactionReceipt({
hash: '0x7057abf025862e54cb1c33b4f4d4e6f8793383098abb84e58a85d1f10d14b765',
}),
).toBeRejectedWith('The Transaction may not be processed on a block yet.')
})
})

describe('Without block specified', () => {
let testnetClient: TestnetClient
let cleanup: () => Promise<void>

before(async () => {
({ client: testnetClient, cleanup } = await factory.create({
;({ client: testnetClient, cleanup } = await factory.create({
id: 'test',
originChainId: 1,
forkChainId: expectedChainId,
Expand Down
7 changes: 3 additions & 4 deletions packages/common-testnets/src/anvil/AnvilTestnetFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { TestnetClient } from '../TestnetClient'
import { CreateNetworkArgs, TestnetCreateResult, TestnetFactory } from '../TestnetFactory'

import { createAnvil } from '@viem/anvil'
import { getAnvilClient } from './AnvilClient'
import { createPublicClient, http } from 'viem'
import getPort from 'get-port'
import { http, createPublicClient } from 'viem'
import { getAnvilClient } from './AnvilClient'

export class AnvilTestnetFactory implements TestnetFactory {
constructor(private readonly opts: { alchemyApiKey: string }) {}
Expand All @@ -20,7 +20,7 @@ export class AnvilTestnetFactory implements TestnetFactory {
return blockNumber
}

const publicClient = createPublicClient({ transport: http(forkUrl)})
const publicClient = createPublicClient({ transport: http(forkUrl) })
return publicClient.getBlockNumber()
})()
const port = await getPort({ port: 8545 })
Expand Down Expand Up @@ -68,4 +68,3 @@ function originChainIdToForkUrl(originChainId: number, alchemyApiKey: string): s
throw new Error(`Unsupported origin chain id: ${originChainId}`)
}
}

0 comments on commit a57ae32

Please sign in to comment.