Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/quiet-faucets-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

Made CLI validation tests independent of public Tempo services.
25 changes: 23 additions & 2 deletions src/cli/validate.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
import type * as http from 'node:http'

import { afterEach, describe, expect, test } from 'vp/test'
import { afterEach, describe, expect, test, vi } from 'vp/test'
import * as Http from '~test/Http.js'

import * as Challenge from '../Challenge.js'
import * as Constants from '../Constants.js'
import * as Receipt from '../Receipt.js'
import validate from './validate/index.js'

// Keep CLI orchestration tests independent of the public Tempo RPC and faucet.
vi.doMock('viem/tempo', async () => {
const actual = await vi.importActual<typeof import('viem/tempo')>('viem/tempo')
return {
...actual,
Actions: {
...actual.Actions,
faucet: { ...actual.Actions.faucet, fund: vi.fn(async () => []) },
},
}
})

vi.doMock('viem/actions', async () => {
const actual = await vi.importActual<typeof import('viem/actions')>('viem/actions')
return {
...actual,
prepareTransactionRequest: vi.fn(async () => ({})),
signTransaction: vi.fn(async () => '0xdeadbeef'),
}
})

// Auto-cleanup for test servers
const servers: Http.TestServer[] = []
Expand All @@ -22,6 +42,7 @@ async function testServer(handler: http.RequestListener) {
}

async function serve(argv: string[]) {
const { default: validate } = await import('./validate/index.js')
let output = ''
let exitCode: number | undefined
const origLog = console.log
Expand Down
Loading