add guildscheduledevents to unit test mock
This commit is contained in:
parent
dc66c277b2
commit
a2adef808f
|
@ -3,7 +3,7 @@ import VoteController, { Vote, VoteMessageInfo } from "../../server/helper/vote.
|
||||||
import { JellyfinHandler } from "../../server/jellyfin/handler"
|
import { JellyfinHandler } from "../../server/jellyfin/handler"
|
||||||
import { ExtendedClient } from "../../server/structures/client"
|
import { ExtendedClient } from "../../server/structures/client"
|
||||||
import { VoteMessage } from "../../server/helper/messageIdentifiers"
|
import { VoteMessage } from "../../server/helper/messageIdentifiers"
|
||||||
test('parse votes from vote message', () => {
|
test('parse votes from vote message', async () => {
|
||||||
const testMovies = [
|
const testMovies = [
|
||||||
'Movie1',
|
'Movie1',
|
||||||
'Movie2',
|
'Movie2',
|
||||||
|
@ -33,6 +33,17 @@ test('parse votes from vote message', () => {
|
||||||
|
|
||||||
const msg: VoteMessage = <VoteMessage><unknown>{
|
const msg: VoteMessage = <VoteMessage><unknown>{
|
||||||
cleanContent: testMessage,
|
cleanContent: testMessage,
|
||||||
|
guild:{
|
||||||
|
id:testGuildId,
|
||||||
|
scheduledEvents:{
|
||||||
|
fetch: jest.fn().mockImplementation((input:any)=>{
|
||||||
|
if(input === testEventId)
|
||||||
|
return {
|
||||||
|
scheduledStartAt: testEventDate
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
reactions: {
|
reactions: {
|
||||||
cache: {
|
cache: {
|
||||||
get: jest.fn().mockImplementation((input: any) => {
|
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))
|
console.log(JSON.stringify(result))
|
||||||
expect(Array.isArray(result)).toBe(false)
|
expect(Array.isArray(result)).toBe(false)
|
||||||
expect(result.eventId).toEqual(testEventId)
|
expect(result.eventId).toEqual(testEventId)
|
||||||
|
|
Loading…
Reference in New Issue