mirror of https://codeberg.org/pzp/pzp-goals.git
fix tests with latest ppppp-db
This commit is contained in:
parent
c29447f694
commit
55d8afd732
|
@ -9,7 +9,7 @@ test('set, getByID, list, listen', async (t) => {
|
||||||
|
|
||||||
await alice.db.loaded()
|
await alice.db.loaded()
|
||||||
const aliceID = await p(alice.db.account.create)({
|
const aliceID = await p(alice.db.account.create)({
|
||||||
domain: 'account',
|
subdomain: 'account',
|
||||||
_nonce: 'alice',
|
_nonce: 'alice',
|
||||||
})
|
})
|
||||||
const aliceAccountRoot = alice.db.getRecord(aliceID)
|
const aliceAccountRoot = alice.db.getRecord(aliceID)
|
||||||
|
@ -68,7 +68,7 @@ test('getMsgPurpose', async (t) => {
|
||||||
|
|
||||||
await alice.db.loaded()
|
await alice.db.loaded()
|
||||||
const aliceID = await p(alice.db.account.create)({
|
const aliceID = await p(alice.db.account.create)({
|
||||||
domain: 'account',
|
subdomain: 'account',
|
||||||
_nonce: 'alice',
|
_nonce: 'alice',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ test('getMsgPurpose ghost', async (t) => {
|
||||||
|
|
||||||
await alice.db.loaded()
|
await alice.db.loaded()
|
||||||
const aliceID = await p(alice.db.account.create)({
|
const aliceID = await p(alice.db.account.create)({
|
||||||
domain: 'account',
|
subdomain: 'account',
|
||||||
_nonce: 'alice',
|
_nonce: 'alice',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,14 @@ const Keypair = require('ppppp-keypair')
|
||||||
|
|
||||||
function createPeer(opts) {
|
function createPeer(opts) {
|
||||||
if (opts.name) {
|
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.keypair ??= Keypair.generate('ed25519', opts.name)
|
||||||
opts.name = undefined
|
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()')
|
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')()
|
return require('secret-stack/bare')()
|
||||||
.use(require('secret-stack/plugins/net'))
|
.use(require('secret-stack/plugins/net'))
|
||||||
.use(require('secret-handshake-ext/secret-stack'))
|
.use(require('secret-handshake-ext/secret-stack'))
|
||||||
|
|
Loading…
Reference in New Issue