Fixed wrong handling of dates in tests failing depending on the day you execute them

This commit is contained in:
joseji 2022-09-16 13:45:20 +02:00
parent 390bb1db3d
commit cfdec3d122

View File

@ -261,14 +261,21 @@ describe('UserResolver', () => {
const peter = await User.findOneOrFail({ id: user[0].id })
peter.isAdmin = new Date()
await peter.save()
// date statement
const actualDate = new Date()
const futureDate = new Date() // Create a future day from the executed day
futureDate.setDate(futureDate.getDate() + 1)
// factory logs in as Peter Lustig
link = await contributionLinkFactory(testEnv, {
name: 'Dokumenta 2022',
memo: 'Vielen Dank für deinen Besuch bei der Dokumenta 2022',
amount: 200,
validFrom: new Date(2022, 5, 18),
validTo: new Date(2022, 8, 25),
validFrom: actualDate,
validTo: futureDate,
})
resetToken()
await mutate({
mutation: createUser,