fix tests
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
mockClearStores,
|
||||
mockOn,
|
||||
mockOnce,
|
||||
mockSendMessage,
|
||||
mockSendTextMessage,
|
||||
mockLogin,
|
||||
mockGetDevices,
|
||||
@@ -30,7 +31,8 @@ import {
|
||||
mockInvite,
|
||||
mockKick,
|
||||
mockGetJoinedRoomMembers,
|
||||
mockGetUser
|
||||
mockGetUser,
|
||||
mockGetGroupUsers
|
||||
} from "matrix-js-sdk";
|
||||
|
||||
import OcrccBot from './bot'
|
||||
@@ -63,13 +65,14 @@ describe('OcrccBot', () => {
|
||||
mockKick.mockClear()
|
||||
mockGetJoinedRoomMembers.mockClear()
|
||||
mockGetUser.mockClear()
|
||||
mockSendMessage.mockClear()
|
||||
mockSendTextMessage.mockClear()
|
||||
mockAppendFileSync.mockClear()
|
||||
mockGetGroupUsers.mockClear()
|
||||
})
|
||||
|
||||
test('constructor should inititialize matrix client', () => {
|
||||
test('constructor should inititialize class variables', () => {
|
||||
const bot = new OcrccBot()
|
||||
expect(createClient).toHaveBeenCalledWith(process.env.MATRIX_SERVER_URL)
|
||||
expect(bot.joinedRooms).toEqual([])
|
||||
expect(bot.awaitingFacilitator).toEqual({})
|
||||
expect(bot.activeChatrooms).toEqual({})
|
||||
@@ -99,7 +102,7 @@ describe('OcrccBot', () => {
|
||||
expect(mockSetDeviceVerified).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
waitForExpect(() => {
|
||||
expect(mockSendTextMessage).toHaveBeenCalledWith(testRoom, testMsg)
|
||||
expect(mockSendMessage).toHaveBeenCalledWith(testRoom, testMsg)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user