mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
mock semaphore to allow to use jest fake timers
This commit is contained in:
parent
cb55da5d32
commit
d03a3f601c
@ -23,6 +23,11 @@ import { User } from '@entity/User'
|
|||||||
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
import { GraphQLError } from 'graphql'
|
import { GraphQLError } from 'graphql'
|
||||||
|
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||||
|
|
||||||
|
// mock semaphore to allow use fake timers
|
||||||
|
jest.mock('@/util/TRANSACTIONS_LOCK')
|
||||||
|
TRANSACTIONS_LOCK.acquire = jest.fn().mockResolvedValue(jest.fn())
|
||||||
|
|
||||||
let mutate: any, query: any, con: any
|
let mutate: any, query: any, con: any
|
||||||
let testEnv: any
|
let testEnv: any
|
||||||
@ -185,8 +190,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
describe('after one day', () => {
|
describe('after one day', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
jest.useFakeTimers()
|
jest.useFakeTimers()
|
||||||
/* eslint-disable-next-line @typescript-eslint/no-empty-function */
|
setTimeout(jest.fn(), 1000 * 60 * 60 * 24)
|
||||||
setTimeout(() => {}, 1000 * 60 * 60 * 24)
|
|
||||||
jest.runAllTimers()
|
jest.runAllTimers()
|
||||||
await mutate({
|
await mutate({
|
||||||
mutation: login,
|
mutation: login,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user