replace ppppp-record with ppppp-dict

This commit is contained in:
Andre Staltz 2023-10-26 13:30:41 +03:00
parent a85403dd34
commit 9a50b8081c
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
3 changed files with 15 additions and 15 deletions

View File

@ -33,9 +33,9 @@
"c8": "7",
"ppppp-caps": "github:staltz/ppppp-caps",
"ppppp-db": "github:staltz/ppppp-db",
"ppppp-dict": "github:staltz/ppppp-dict",
"ppppp-goals": "github:staltz/ppppp-goals",
"ppppp-keypair": "github:staltz/ppppp-keypair",
"ppppp-record": "github:staltz/ppppp-record",
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3",
"rimraf": "^4.4.0",

View File

@ -22,11 +22,11 @@ function isPresent(msg) {
return !!msg.data.update
}
test('record ghosts', async (t) => {
test('Dict ghosts', async (t) => {
const alice = createPeer({
name: 'alice',
gc: { maxLogBytes: 100 * 1024 * 1024 },
record: { ghostSpan: 2 },
dict: { ghostSpan: 2 },
})
await alice.db.loaded()
@ -37,14 +37,14 @@ test('record ghosts', async (t) => {
_nonce: 'alice',
})
// Alice constructs a record
await p(alice.record.load)(aliceID)
await p(alice.record.update)('profile', { name: 'alice' })
await p(alice.record.update)('profile', { age: 24 })
await p(alice.record.update)('profile', { name: 'Alice' })
await p(alice.record.update)('profile', { age: 25 })
await p(alice.record.update)('profile', { name: 'ALICE' })
const recordID = alice.record.getFeedID('profile')
// Alice constructs adict
await p(alice.dict.load)(aliceID)
await p(alice.dict.update)('profile', { name: 'alice' })
await p(alice.dict.update)('profile', { age: 24 })
await p(alice.dict.update)('profile', { name: 'Alice' })
await p(alice.dict.update)('profile', { age: 25 })
await p(alice.dict.update)('profile', { name: 'ALICE' })
const dictID = alice.dict.getFeedID('profile')
let mootID
let msgID1
@ -65,7 +65,7 @@ test('record ghosts', async (t) => {
assert.deepEqual(
getFields([...alice.db.msgs()]),
['alice', 24, 'Alice', 25, 'ALICE'],
'has all record msgs'
'has all dict msgs'
)
assert.ok(isErased(alice.db.get(mootID)), 'moot by def erased')
assert.ok(isPresent(alice.db.get(msgID1)), 'msg1 exists')
@ -76,7 +76,7 @@ test('record ghosts', async (t) => {
// Perform garbage collection
alice.goals.set(aliceID, 'all')
alice.goals.set(recordID, 'record')
alice.goals.set(dictID, 'dict')
await p(alice.gc.forceImmediately)()
// Assert situation after GC
@ -93,7 +93,7 @@ test('record ghosts', async (t) => {
assert.ok(isPresent(alice.db.get(msgID4)), 'msg4 exists')
assert.ok(isPresent(alice.db.get(msgID5)), 'msg5 exists')
assert.deepEqual(alice.db.ghosts.get(recordID), [msgID2])
assert.deepEqual(alice.db.ghosts.get(dictID), [msgID2])
await p(alice.close)(true)
})

View File

@ -18,7 +18,7 @@ function createPeer(opts) {
.use(require('secret-stack/plugins/net'))
.use(require('secret-handshake-ext/secret-stack'))
.use(require('ppppp-db'))
.use(require('ppppp-record'))
.use(require('ppppp-dict'))
.use(require('ppppp-goals'))
.use(require('ssb-box'))
.use(require('../lib'))