fix tests with latest ppppp-db

This commit is contained in:
Andre Staltz 2023-11-28 10:04:34 +02:00
parent c29447f694
commit 55d8afd732
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
2 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ test('set, getByID, list, listen', async (t) => {
await alice.db.loaded()
const aliceID = await p(alice.db.account.create)({
domain: 'account',
subdomain: 'account',
_nonce: 'alice',
})
const aliceAccountRoot = alice.db.getRecord(aliceID)
@ -68,7 +68,7 @@ test('getMsgPurpose', async (t) => {
await alice.db.loaded()
const aliceID = await p(alice.db.account.create)({
domain: 'account',
subdomain: 'account',
_nonce: 'alice',
})
@ -110,7 +110,7 @@ test('getMsgPurpose ghost', async (t) => {
await alice.db.loaded()
const aliceID = await p(alice.db.account.create)({
domain: 'account',
subdomain: 'account',
_nonce: 'alice',
})

View File

@ -6,14 +6,14 @@ const Keypair = require('ppppp-keypair')
function createPeer(opts) {
if (opts.name) {
opts.path ??= path.join(os.tmpdir(), 'tanglesync-' + opts.name)
opts.db ??= { path: path.join(os.tmpdir(), 'tanglesync-' + opts.name) }
opts.keypair ??= Keypair.generate('ed25519', opts.name)
opts.name = undefined
}
if (!opts.path) throw new Error('need opts.path in createPeer()')
if (!opts.db.path) throw new Error('need opts.db.path in createPeer()')
if (!opts.keypair) throw new Error('need opts.keypair in createPeer()')
rimraf.sync(opts.path)
rimraf.sync(opts.db.path)
return require('secret-stack/bare')()
.use(require('secret-stack/plugins/net'))
.use(require('secret-handshake-ext/secret-stack'))