Use buildEvent function in more places

This commit is contained in:
Alex Gleason
2023-05-10 16:20:27 -05:00
committed by fiatjaf_
parent 67a8ee23ce
commit 82caa2aad9
3 changed files with 9 additions and 20 deletions

View File

@@ -1,4 +1,5 @@
import {nip26, getPublicKey, generatePrivateKey} from '.'
import { buildEvent } from './test-helpers'
test('parse good delegation from NIP', async () => {
expect(
@@ -94,14 +95,10 @@ test('create and verify delegation', async () => {
expect(delegation).toHaveProperty('to', pk2)
expect(delegation).toHaveProperty('cond', 'kind=1')
let event = {
let event = buildEvent({
kind: 1,
tags: [['delegation', delegation.from, delegation.cond, delegation.sig]],
pubkey: pk2,
content: '',
created_at: 0,
id: '',
sig: '',
}
})
expect(nip26.getDelegator(event)).toEqual(pk1)
})