Use buildEvent function in more places
This commit is contained in:
parent
67a8ee23ce
commit
82caa2aad9
|
@ -1,4 +1,5 @@
|
|||
import {nip18, finishEvent, getPublicKey, Kind} from '.'
|
||||
import { buildEvent } from './test-helpers'
|
||||
|
||||
const relayUrl = 'https://relay.example.com'
|
||||
|
||||
|
@ -95,15 +96,10 @@ describe('finishRepostEvent + getRepostedEventPointer + getRepostedEvent', () =>
|
|||
|
||||
describe('getRepostedEventPointer', () => {
|
||||
it('should parse an event with only an `e` tag', () => {
|
||||
const event = {
|
||||
const event = buildEvent({
|
||||
kind: Kind.Repost,
|
||||
tags: [['e', 'reposted event id', relayUrl]],
|
||||
content: '',
|
||||
created_at: 0,
|
||||
pubkey: '',
|
||||
id: '',
|
||||
sig: '',
|
||||
}
|
||||
})
|
||||
|
||||
const repostedEventPointer = nip18.getRepostedEventPointer(event)
|
||||
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import {parseReferences} from '.'
|
||||
import { buildEvent } from './test-helpers'
|
||||
|
||||
test('parse mentions', () => {
|
||||
let evt = {
|
||||
kind: 1,
|
||||
id: '',
|
||||
pubkey: '',
|
||||
let evt = buildEvent({
|
||||
tags: [
|
||||
[
|
||||
'p',
|
||||
|
@ -25,9 +23,7 @@ test('parse mentions', () => {
|
|||
],
|
||||
content:
|
||||
'hello #[0], have you seen #[2]? it was made by nostr:nprofile1qqsvc6ulagpn7kwrcwdqgp797xl7usumqa6s3kgcelwq6m75x8fe8yc5usxdg on nostr:nevent1qqsvc6ulagpn7kwrcwdqgp797xl7usumqa6s3kgcelwq6m75x8fe8ychxp5v4! broken #[3]',
|
||||
created_at: 0,
|
||||
sig: '',
|
||||
}
|
||||
})
|
||||
|
||||
expect(parseReferences(evt)).toEqual([
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue