Skip to content
Merged
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
35 changes: 35 additions & 0 deletions test/mock-api-module-wiring.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import './setup-env'
import { describe, it } from 'node:test'
import assert from 'node:assert'
import { MockAccessApi } from '../lib/api/mock'
import { getApi } from '../lib/api'

// Regression guard for #382: lib/api/mock.ts previously grew into a single
// 2000+ line file with an unmatched block delimiter, which broke parsing of
// the whole module and, transitively, lib/api/index.ts and components/nav.tsx.
// It has since been split into lib/api/mock/*.ts domain modules aggregated
// by MockAccessApi. This test exercises one method from each domain module
// through the public boundary to catch a future wiring/parse regression.
describe('MockAccessApi module wiring (#382)', () => {
const TEST_ADDRESS = '0x1234567890123456789012345678901234567890'

it('lib/api/index.ts imports the mock boundary without a parse error', () => {
assert.strictEqual(typeof getApi, 'function')
})

it('composes every domain module onto a single MockAccessApi instance', async () => {
const api = new MockAccessApi(TEST_ADDRESS)

await assert.doesNotReject(api.getMeta())
await assert.doesNotReject(api.getSession())
await assert.doesNotReject(api.getCommunity())
await assert.doesNotReject(api.listMembers())
await assert.doesNotReject(api.listWebhookEvents())
await assert.doesNotReject(api.getAnalyticsSummary())
await assert.doesNotReject(api.getPendingActions())
await assert.doesNotReject(api.getConnections(TEST_ADDRESS))
await assert.doesNotReject(api.listReports())
await assert.doesNotReject(api.listProposals())
assert.ok(api.analytics)
})
})