Files
bare-operating-system/packages/bare-os-coreutils/test/swarmtop-peer-visibility.test.mjs
T
snxraven db6dfa22e3
Release rolling / release (push) Successful in 9m54s
Fix CI
2026-08-18 18:30:46 -04:00

24 lines
1.0 KiB
JavaScript

import test from 'brittle'
import { readFile } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = dirname(fileURLToPath(import.meta.url))
const coreutilsRoot = join(__dirname, '..')
test('p2p suite reads peer_details proc for swarm snapshots', async (t) => {
const src = await readFile(join(coreutilsRoot, 'lib/p2p/p2p-suite.js'), 'utf8')
t.ok(src.includes('/proc/bare_os/peer_details.json'), 'reads peer details proc')
t.ok(src.includes('out.peers = merged.slice(0, 128)'), 'merges swarm + peer details rows')
})
test('swarmtop renders full public keys and endpoint details', async (t) => {
const src = await readFile(join(coreutilsRoot, 'src/swarmtop.js'), 'utf8')
t.ok(src.includes("lines.push(' pubkey: ' + key)"), 'shows full pubkey label')
t.ok(src.includes('endpoint='), 'shows endpoint details')
t.ok(
src.includes('? p.remotePublicKey') || src.includes('? p.remotePublicKey\n'),
'uses full remotePublicKey value in peer rows'
)
})