add guildscheduledevents to unit test mock
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user