add new test for eventId parsing

This commit is contained in:
kenobi 2023-07-17 22:49:12 +02:00
parent 137d156981
commit e763e76413
1 changed files with 20 additions and 1 deletions

View File

@ -13,8 +13,9 @@ test('parse votes from vote message', () => {
] ]
const testEventId = '1234321' const testEventId = '1234321'
const testEventDate = new Date('2023-01-01') const testEventDate = new Date('2023-01-01')
const testGuildId = "888999888"
const voteController: VoteController = new VoteController(<ExtendedClient>{}, <JellyfinHandler>{}) const voteController: VoteController = new VoteController(<ExtendedClient>{}, <JellyfinHandler>{})
const testMessage = voteController.createVoteMessageText(testEventId, testEventDate, testMovies, "guildid", "requestId") const testMessage = voteController.createVoteMessageText(testEventId, testEventDate, testMovies, testGuildId, "requestId")
const expectedResult: VoteMessageInfo = { const expectedResult: VoteMessageInfo = {
@ -53,3 +54,21 @@ test('parse votes from vote message', () => {
expect(result.votes.length).toEqual(expectedResult.votes.length) expect(result.votes.length).toEqual(expectedResult.votes.length)
expect(result).toEqual(expectedResult) expect(result).toEqual(expectedResult)
}) })
test('parse votes from vote message', () => {
const testMovies = [
'Movie1',
'Movie2',
'Movie3',
'Movie4',
'Movie5',
]
const testEventId = '1234321'
const testEventDate = new Date('2023-01-01')
const testGuildId = "888999888"
const voteController: VoteController = new VoteController(<ExtendedClient>{}, <JellyfinHandler>{})
const testMessage = voteController.createVoteMessageText(testEventId, testEventDate, testMovies, testGuildId, "requestId")
const result = voteController.parseGuildIdAndEventIdFromWholeMessage(testMessage)
expect(result).toEqual({ guildId: testGuildId, eventId: testEventId })
})