Compare commits
No commits in common. "a6f19ccd2b1b0708fb294db7feda4526da51f26e" and "f41194ba719f4fa392c205ec86ca05e705dbef2b" have entirely different histories.
a6f19ccd2b
...
f41194ba71
@ -1,16 +0,0 @@
|
||||
import { GuildScheduledEvent } from "discord.js"
|
||||
import { createDateStringFromEvent } from "../../server/helper/dateHelper"
|
||||
import MockDate from 'mockdate'
|
||||
|
||||
beforeAll(() => {
|
||||
MockDate.set('01-01-2023')
|
||||
})
|
||||
|
||||
function getTestDate(date: string): GuildScheduledEvent {
|
||||
return <GuildScheduledEvent>{ scheduledStartAt: new Date(date) }
|
||||
}
|
||||
test('createDateStringFromEvent - correct formatting', () => {
|
||||
expect(createDateStringFromEvent(getTestDate('01-01-2023 12:30'), "")).toEqual('heute um 12:30')
|
||||
expect(createDateStringFromEvent(getTestDate('01-02-2023 12:30'), "")).toEqual('am Montag 02.01. um 12:30')
|
||||
expect(createDateStringFromEvent(getTestDate('01-03-2023 12:30'), "")).toEqual('am Dienstag 03.01 um 12:30')
|
||||
})
|
@ -1,28 +0,0 @@
|
||||
import { Collection, GuildMember, Role } from "discord.js"
|
||||
import { filterRolesFromMemberUpdate } from "../../server/helper/roleFilter"
|
||||
|
||||
function buildFakeRole(id: string, name: string): Role {
|
||||
return <Role>{ id, name }
|
||||
|
||||
}
|
||||
test('filterRolesFromMemberUpdate', () => {
|
||||
const oldMemberRoles: Collection<string, Role> = new Collection<string, Role>()
|
||||
oldMemberRoles.set('1', buildFakeRole('01', 'Role01'))
|
||||
oldMemberRoles.set('2', buildFakeRole('02', 'Role02'))
|
||||
|
||||
const newMemberRoles: Collection<string, Role> = new Collection<string, Role>()
|
||||
newMemberRoles.set('1', buildFakeRole('01', 'Role01'))
|
||||
newMemberRoles.set('2', buildFakeRole('02', 'Role02'))
|
||||
newMemberRoles.set('3', buildFakeRole('03', 'Role03'))
|
||||
|
||||
const oldMember: GuildMember = <GuildMember>{ roles: { cache: oldMemberRoles }, guild: { id: "guildid" } }
|
||||
const newMember: GuildMember = <GuildMember>{ roles: { cache: newMemberRoles }, guild: { id: "guildid" } }
|
||||
const output = filterRolesFromMemberUpdate(oldMember, newMember)
|
||||
|
||||
const expectedAddedRoles: Collection<string, Role> = new Collection<string, Role>()
|
||||
expectedAddedRoles.set('3', buildFakeRole('03', 'Role03'))
|
||||
const expectedRemovedRoles: Collection<string, Role> = new Collection<string, Role>()
|
||||
|
||||
expect(output.addedRoles).toEqual(expectedAddedRoles)
|
||||
expect(output.removedRoles).toEqual(expectedRemovedRoles)
|
||||
})
|
Loading…
Reference in New Issue
Block a user