fix: resolve all TypeScript errors in WAProto and test files
- Changed WAProto.proto syntax from proto3 to proto2 to support required fields - Regenerated WAProto static files (index.d.ts, index.js) with correct proto2 syntax - Fixed type annotations in test files (circuit-breaker, sync-action-utils, trace-context) - Fixed Mock type errors in baileys-event-stream and cache-utils tests - Fixed LID mapping test expectations to match array type - All 78 TypeScript errors resolved, 0 remaining https://claude.ai/code/session_015R3U3kiprQiNTTNNt31Sg6
This commit is contained in:
@@ -88,7 +88,7 @@ describe('BaileysEventStream', () => {
|
||||
|
||||
describe('event handlers', () => {
|
||||
it('should call handler for specific event type', async () => {
|
||||
const handler = jest.fn()
|
||||
const handler = jest.fn() as any
|
||||
|
||||
stream.on('messages.upsert', handler)
|
||||
stream.push('messages.upsert', { message: 'test' })
|
||||
@@ -100,7 +100,7 @@ describe('BaileysEventStream', () => {
|
||||
})
|
||||
|
||||
it('should call global handler for all events', async () => {
|
||||
const handler = jest.fn()
|
||||
const handler = jest.fn() as any
|
||||
|
||||
stream.on('*', handler)
|
||||
stream.push('messages.upsert', { message: 'test' })
|
||||
@@ -112,7 +112,7 @@ describe('BaileysEventStream', () => {
|
||||
})
|
||||
|
||||
it('should support once handler', async () => {
|
||||
const handler = jest.fn()
|
||||
const handler = jest.fn() as any
|
||||
|
||||
stream.once('messages.upsert', handler)
|
||||
stream.push('messages.upsert', { first: true })
|
||||
@@ -124,7 +124,7 @@ describe('BaileysEventStream', () => {
|
||||
})
|
||||
|
||||
it('should remove handler with off', async () => {
|
||||
const handler = jest.fn()
|
||||
const handler = jest.fn() as any
|
||||
|
||||
stream.on('messages.upsert', handler)
|
||||
stream.off('messages.upsert', handler)
|
||||
@@ -138,7 +138,7 @@ describe('BaileysEventStream', () => {
|
||||
|
||||
describe('pause and resume', () => {
|
||||
it('should pause processing', async () => {
|
||||
const handler = jest.fn()
|
||||
const handler = jest.fn() as any
|
||||
|
||||
stream.on('messages.upsert', handler)
|
||||
stream.pause()
|
||||
@@ -153,7 +153,7 @@ describe('BaileysEventStream', () => {
|
||||
})
|
||||
|
||||
it('should resume processing', async () => {
|
||||
const handler = jest.fn()
|
||||
const handler = jest.fn() as any
|
||||
|
||||
stream.on('messages.upsert', handler)
|
||||
stream.pause()
|
||||
@@ -168,7 +168,7 @@ describe('BaileysEventStream', () => {
|
||||
|
||||
describe('flush', () => {
|
||||
it('should process all buffered events', async () => {
|
||||
const handler = jest.fn()
|
||||
const handler = jest.fn() as any
|
||||
|
||||
stream.pause()
|
||||
stream.on('messages.upsert', handler)
|
||||
@@ -187,9 +187,9 @@ describe('BaileysEventStream', () => {
|
||||
|
||||
describe('filters', () => {
|
||||
it('should filter events before processing', async () => {
|
||||
const handler = jest.fn()
|
||||
const handler = jest.fn() as any
|
||||
|
||||
stream.addFilter((event) => event.data.include === true)
|
||||
stream.addFilter((event) => (event.data as any).include === true)
|
||||
stream.on('*', handler)
|
||||
|
||||
stream.push('messages.upsert', { include: true })
|
||||
@@ -206,7 +206,7 @@ describe('BaileysEventStream', () => {
|
||||
stream.addFilter(filter)
|
||||
stream.removeFilter(filter)
|
||||
|
||||
const handler = jest.fn()
|
||||
const handler = jest.fn() as any
|
||||
stream.on('*', handler)
|
||||
|
||||
stream.push('messages.upsert', { test: true })
|
||||
@@ -233,7 +233,7 @@ describe('BaileysEventStream', () => {
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 50))
|
||||
|
||||
expect(receivedEvent?.metadata?.transformed).toBe(true)
|
||||
expect((receivedEvent as any)?.metadata?.transformed).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user