fakejson match subscription id.

This commit is contained in:
fiatjaf
2023-02-08 12:14:17 -03:00
parent 4485c8ed5e
commit b5c8255b2f
2 changed files with 29 additions and 0 deletions

View File

@@ -33,3 +33,17 @@ test('match kind', () => {
)
).toBeTruthy()
})
test('match subscription id', () => {
expect(fj.getSubscriptionId('["EVENT","",{}]')).toEqual('')
expect(fj.getSubscriptionId('["EVENT","_",{}]')).toEqual('_')
expect(fj.getSubscriptionId('["EVENT","subname",{}]')).toEqual('subname')
expect(fj.getSubscriptionId('["EVENT", "kasjbdjkav", {}]')).toEqual(
'kasjbdjkav'
)
expect(
fj.getSubscriptionId(
' [ \n\n "EVENT" , \n\n "y4d5ow45gfwoiudfÇA VSADLKAN KLDASB[12312535]SFMZSNJKLH" , {}]'
)
).toEqual('y4d5ow45gfwoiudfÇA VSADLKAN KLDASB[12312535]SFMZSNJKLH')
})