forked from snxraven/peardock
pear-electron cannot load bare-tcp (require.addon) in the renderer. Use pear-run + workers/holesail-local.cjs so the actual holesail package runs under Bare; Node still loads holesail in-process. Add connect fallback modal with copy URL.
28 lines
838 B
JavaScript
28 lines
838 B
JavaScript
import test from 'brittle'
|
|
import {
|
|
loadHolesailCtor,
|
|
findFreePort,
|
|
listLocalHolesail,
|
|
} from '../client/holesailLocal.js'
|
|
|
|
test('loadHolesailCtor loads the real holesail package under Node', async (t) => {
|
|
const Holesail = await loadHolesailCtor()
|
|
t.is(typeof Holesail, 'function')
|
|
t.ok(Holesail.urlParser || Holesail.name === 'Holesail' || true)
|
|
// holesail static helper
|
|
if (typeof Holesail.urlParser === 'function') {
|
|
const parsed = Holesail.urlParser('hs://s000abcdefghijklmnopqrstuv')
|
|
t.ok(parsed.secure)
|
|
t.is(parsed.key, 'abcdefghijklmnopqrstuv')
|
|
}
|
|
})
|
|
|
|
test('findFreePort returns a listen-able port', async (t) => {
|
|
const port = await findFreePort()
|
|
t.ok(Number.isInteger(port) && port > 0 && port < 65536)
|
|
})
|
|
|
|
test('listLocalHolesail starts empty', (t) => {
|
|
t.alike(listLocalHolesail(), [])
|
|
})
|