Fix some tests
This commit is contained in:
@@ -186,12 +186,12 @@ describe("Events", () => {
|
||||
it("should validate signature using verifiedSymbol", () => {
|
||||
let event = createSignedEvent() as Events.SignedEvent
|
||||
event[verifiedSymbol] = true
|
||||
expect(Events.hasValidSignature(event)).toBe(true)
|
||||
expect(Events.verifyEvent(event)).toBe(true)
|
||||
|
||||
// Clear verifiedSymbol and use verify the actual signature
|
||||
// Clear verifiedSymbol and verify the actual signature
|
||||
delete event[verifiedSymbol]
|
||||
// the signature is invalid, but the sig validity is not checked here
|
||||
expect(Events.hasValidSignature(event)).toBe(true)
|
||||
// the signature is invalid, so verifyEvent should return false
|
||||
expect(Events.verifyEvent(event)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ describe("Filters", () => {
|
||||
|
||||
it("should get filter result cardinality", () => {
|
||||
expect(Filters.getFilterResultCardinality({ids: [id, id + "1"]})).toBe(2)
|
||||
expect(Filters.getFilterResultCardinality({kinds: [1]})).toBeNull()
|
||||
expect(Filters.getFilterResultCardinality({kinds: [1]})).toBeUndefined()
|
||||
})
|
||||
|
||||
it("should trim large filters", () => {
|
||||
|
||||
@@ -72,7 +72,7 @@ export const verifyEvent = (() => {
|
||||
})
|
||||
}
|
||||
|
||||
return (event: TrustedEvent) => event.sig && verify(event as SignedEvent)
|
||||
return (event: TrustedEvent) => event.sig && (event[verifiedSymbol] || verify(event as SignedEvent))
|
||||
})()
|
||||
|
||||
export const isEventTemplate = (e: EventTemplate): e is EventTemplate =>
|
||||
|
||||
Reference in New Issue
Block a user