Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
clairton committed Oct 5, 2024
1 parent 2a2b418 commit 8385100
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions __tests__/services/client_baileys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
fetchGroupMetadata,
exists,
close,
logout,
} from '../../src/services/socket'
import { mock, mockFn } from 'jest-mock-extended'
import { proto } from '@whiskeysockets/baileys'
Expand Down Expand Up @@ -44,6 +45,7 @@ describe('service client baileys', () => {
let dataStore: DataStore
let send
let read
let logout
let exists
let rejectCall
let fetchImageUrl
Expand Down Expand Up @@ -77,9 +79,10 @@ describe('service client baileys', () => {
read = mockFn<readMessages>().mockResolvedValue(true)
exists = mockFn<exists>()
rejectCall = mockFn<rejectCall>()
logout = mockFn<logout>()
fetchImageUrl = mockFn<fetchImageUrl>()
fetchGroupMetadata = mockFn<fetchGroupMetadata>()
mockConnect.mockResolvedValue({ event, status, send, read, rejectCall, fetchImageUrl, fetchGroupMetadata, exists, close })
mockConnect.mockResolvedValue({ event, status, send, read, rejectCall, fetchImageUrl, fetchGroupMetadata, exists, close, logout })
})

test('call send with unknown status', async () => {
Expand Down Expand Up @@ -133,7 +136,7 @@ describe('service client baileys', () => {
send = async () => {
throw new SendError(1, '')
}
mockConnect.mockResolvedValue({ event, status, send, read, rejectCall, fetchImageUrl, fetchGroupMetadata, exists, close })
mockConnect.mockResolvedValue({ event, status, send, read, rejectCall, fetchImageUrl, fetchGroupMetadata, exists, close, logout })
await client.connect(0)
const response = await client.send(payload, {})
expect(response.error.entry.length).toBe(1)
Expand Down

0 comments on commit 8385100

Please sign in to comment.