From dc58f150a24f80e79d84857017b4ac45d697e495 Mon Sep 17 00:00:00 2001 From: Jacob Karlsson Date: Thu, 2 Nov 2023 22:01:23 +0100 Subject: [PATCH] Add test for ownKeys --- test/api/own-keys/register-and-list.test.js | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/api/own-keys/register-and-list.test.js diff --git a/test/api/own-keys/register-and-list.test.js b/test/api/own-keys/register-and-list.test.js new file mode 100644 index 0000000..699d8ef --- /dev/null +++ b/test/api/own-keys/register-and-list.test.js @@ -0,0 +1,23 @@ +const { promisify: p } = require('util') +const test = require('tape') +const { keySchemes } = require('private-group-spec') +const { Server } = require('../../helpers') + +test('can set and get own self dm key', async (t) => { + const alice = Server() + + const ownKey = Buffer.from( + '30720d8f9cbf37f6d7062826f6decac93e308060a8aaaa77e6a4747f40ee1a76', + 'hex' + ) + + alice.tribes.ownKeys.register(ownKey) + + const gottenKeyList = await p(alice.tribes.ownKeys.list)() + const gottenKey = gottenKeyList[0] + + t.equal(gottenKey.key, ownKey, 'got correct key') + t.equal(gottenKey.scheme, keySchemes.feed_id_self, 'got correct scheme') + + await p(alice.close)() +}) \ No newline at end of file