mirror of
https://github.com/Cameri/nostream.git
synced 2025-04-09 20:29:07 +02:00
chore: reject events with unknown keys
This commit is contained in:
parent
4cbbb0f5b2
commit
ed84602b9e
@ -35,4 +35,4 @@ export const eventSchema = Schema.object({
|
||||
.allow('')
|
||||
.required(),
|
||||
sig: signatureSchema.required(),
|
||||
})
|
||||
}).unknown(false)
|
||||
|
@ -56,6 +56,14 @@ describe('NIP-01', () => {
|
||||
expect(result.value).to.deep.equal(event)
|
||||
})
|
||||
|
||||
|
||||
it('returns error if unknown key is provided', () => {
|
||||
Object.assign(event, { unknown: 1 })
|
||||
|
||||
expect(validateSchema(eventSchema)(event)).to.have.nested.property('error.message', '"unknown" is not allowed')
|
||||
})
|
||||
|
||||
|
||||
const cases = {
|
||||
id: [
|
||||
{ message: 'must be a string', transform: assocPath(['id'], null) },
|
||||
|
Loading…
x
Reference in New Issue
Block a user