add guildscheduledevents to unit test mock
All checks were successful
Compile the repository / compile (pull_request) Successful in 14m58s
Run unit tests / test (pull_request) Successful in 4m18s

This commit is contained in:
kenobi 2023-07-17 23:31:00 +02:00
parent dc66c277b2
commit a2adef808f

View File

@ -3,7 +3,7 @@ import VoteController, { Vote, VoteMessageInfo } from "../../server/helper/vote.
import { JellyfinHandler } from "../../server/jellyfin/handler"
import { ExtendedClient } from "../../server/structures/client"
import { VoteMessage } from "../../server/helper/messageIdentifiers"
test('parse votes from vote message', () => {
test('parse votes from vote message', async () => {
const testMovies = [
'Movie1',
'Movie2',
@ -33,6 +33,17 @@ test('parse votes from vote message', () => {
const msg: VoteMessage = <VoteMessage><unknown>{
cleanContent: testMessage,
guild:{
id:testGuildId,
scheduledEvents:{
fetch: jest.fn().mockImplementation((input:any)=>{
if(input === testEventId)
return {
scheduledStartAt: testEventDate
}
})
}
},
reactions: {
cache: {
get: jest.fn().mockImplementation((input: any) => {
@ -46,7 +57,7 @@ test('parse votes from vote message', () => {
}
}
const result = voteController.parseVotesFromVoteMessage(msg, 'requestId')
const result = await voteController.parseVoteInfoFromVoteMessage(msg, 'requestId')
console.log(JSON.stringify(result))
expect(Array.isArray(result)).toBe(false)
expect(result.eventId).toEqual(testEventId)