Skip to content

Commit

Permalink
Match gets with old and new bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Powersource committed Nov 1, 2023
1 parent 1670fde commit 8bd577c
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/from-old-versions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ test('can continue from old keyring from ssb-tribes 3.1.3', async t => {

const oldGroup = await p(oldAlice.tribes.create)({})

t.equal(typeof oldGroup.groupId, 'string', "got a group id")
t.equal(typeof oldGroup.groupId, 'string', "got a group id when creating using old bot")

const oldList = await p(oldAlice.tribes.list)()
t.deepEqual(oldList, [oldGroup.groupId], 'group got listed')
t.deepEqual(oldList, [oldGroup.groupId], 'group got listed by old bot')

// TODO: get group as well
const oldGet = await p(oldAlice.tribes.get)(oldGroup.groupId)

t.equal(oldGet.groupId, oldGroup.groupId, "got correct groupId")
t.equal(oldGet.key, oldGroup.groupKey, "got correct key")
t.equal(typeof oldGet.scheme, "string", "got scheme")
t.equal(typeof oldGet.root, "string", "got root")

await p(oldAlice.close)(true)

Expand All @@ -49,7 +54,14 @@ test('can continue from old keyring from ssb-tribes 3.1.3', async t => {
const newList = await p(newAlice.tribes.list)()
t.deepEqual(newList, oldList, 'new bot has same group list as old')

// TODO: make sure old get matches new get
const newGet = await p(newAlice.tribes.get)(oldGroup.groupId)

t.deepEqual(newGet, {
groupId: oldGet.groupId,
writeKey: { key: oldGet.key, scheme: oldGet.scheme },
readKeys: [{ key: oldGet.key, scheme: oldGet.scheme }],
root: oldGet.root,
}, "get with new bot matches get with old bot")

await p(newAlice.close)()
})

0 comments on commit 8bd577c

Please sign in to comment.